Grasshopper

algorithmic modeling for Rhino

i have a curve and a point on this curve and want to generate a line perpendicular to the curve through the point.

any ideas how to do that?

thanks in advance !

Views: 763

Replies to This Discussion

Yellow group is your case, the others are the inverse.

Attachments:

thanks a lot !

it does not really work perfectly in my case, but its not as simple as i thought. i will try to give a more detailed explanation tomorrow ...

Just post your case. I would be rather easy to address any requirement.

hello peter,
at first: thanks a lot for your help, much appreciated!
i attached a sample rhino file to show my case. in the file there are 5 circles, my "real problem case" contains thousands.
the circles are not real rhino circles, they are dwg-imports from illustrator, so they dont have weighted cvs but the deviation from an ideal circle is about 6/1000 (neglectable, only to let you know).
what i need is lines normal to the circle (= pointing from one circle center to the next) at the intersection points of two circles. as the circles intersect at only one point, they share the same tangent at this point. i contructed the (orange) lines in rhino to show, what i mean.
the circles are the result of a circle packing algorithm, so they are not always intersecting perfectly, as shown on a separate layer.
the intersection poits were generated in grasshopper. i attached the definition just as a "very beginning to the problem".
if this is more complex than you expected and you dont feel like likesolving it, i wont be disappointed. otherwise i´d like to thank you in advance.
cheers
roberto



Attachments:

I'll give it a spin (with components) and if ... er ... it's "impossible" (or it breaks my nerves) I'll switch to the Dark Side (*) where NOTHING is impossible. Of course there's always the possibility to get the non C# solution by another (orthodox: meaning components) good Samaritan, he he.

(*) C#.

Note: I have also packing algos (in C#) but unfortunately are classified as internal.

Moral: Darkness is the new Light.

best, Lord of Darkness

hey darth,

sounds interesting, i am really curious, if its possible!

my packing algo was very basic and produced many mistakes. i am very short of time in this project, so i had to use it and make a lot of "handwork". maybe for the next project i will search something better. are your scripts developped for a company or are you on your own? are they also kangaroo based?

Well ... my dear Watson:

This is elementary (since that MCX thingy DOES provide the right indices for the job, but I would prefer a classic "event" [kinda like the connectivity trees] tree instead of these Lists - for clarity, that is).

I'll add some checks (for fun) to that C# and I'll post it here ASAP (but attachments are not possible lately, thus provide your e-mail).

I'll translate the C# into components as well.

BTW: Rhino reports that these are NOT circles (but the method does business with doc tolerance) but I guess that we proceed by assuming that they are (if not notify to modify the code):

public Point3d FindCenter(Curve curv){
    Point3d pCent;
    Circle circle;
    if(curv.TryGetCircle(out circle)){ // is it Circle?
      pCent = circle.Center;
    }
    else{ // is it a Bird? a Plane? maybe Superman?
      pCent = AreaMassProperties.Compute(curv).Centroid;
    }
    return pCent;
  }

Here we are:

Get the V1 thingy that works (but requires some double espressos more in order to make it faster, or way faster with triple espressos + some proper cigars).

1M Q: can the trad update (V2) cut the mustard?

Note: this tests (a) if the curve is a Circle (is not according to the method captured above ... meaning that the AreaMassProperties method is used that is slower than the circle.Center) and (b) if is closed (otherwise goes for Plan B). I'll add controls to [optionally] skip these a bit time consuming "better-safe-than-sorry" checks.

Note: spot the information related with more than one intersection events per pair (meaning that the pack algo used ... hmm ... was the "optimistic" version, he he).

best, Lord of Darkness

Attachments:

WOW, impressive and thanks a lot!

at the moment i am very muck stuck in a job, so i dont even have the time to check it out.

i´ll be back, if its getting easier. meanwhile i used a workaround, which cost some time ...

thanks again

cheers

watson

V2 become V3 (still WIP) so get ... er ... hmm ... the V2

Note: Translation to components postponed due to espresso quality/quantity issues (out of cigars as well).

best, The Lord

Attachments:

hi lord,

thanks a lot for your work !! wish i could share a cigar and cup of espresso with you.

finally found some time to see your solution. i must admit i dont really understand, what happening here, but it really has a high entertainment value and can be read just like a comic strip  ;)

after all i found a basically different solution for my problem which does not take the intersections into account, but i think i can use your approach in other cases and will try to understand then.

thanks again

roberto

And here's the V3 (more bugs, slower, more chaotic options ... kinda upgrading from XP to that ... er ... Vista thing [known as The Crap]).

Spot the mixed (open/closed) curves test included.

best, Lord of Darkness, King of SardineLand 

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service