Grasshopper

algorithmic modeling for Rhino

Hi,

mathematically speaking, I don't know how to find a cross product between multiple lines (more than 2).

I tried using a geometric approach to go ahead:

given some triangular surfaces, i find the intersection line (blue crvs) between a sphere based in the common vertex of these triangles and the triangles itselves.

Once i have this surface I try to get the centre and connect it to the initial common vertex (violet crvs).

This line represents the most barycentrical line of this geometry.

The problems are:

1) Too heavy to calculate for hundreds of vertex, as I need to work with surfaces

2) The centre is not so precise, because of the optimisation that GH does in these super freeform surfaces.

How to get the centre using only the edges?

Thank you!

?

Views: 6508

Attachments:

Replies to This Discussion

There is a component for this in the Vectors Tab

Hi danny, but i don't understand how it works for many vectors (not 2)

Well...

... a Cross Product is this (and ONLY this: meaning that there's not yet invented a CP with more than 2 vectors, he he):

BTW: you want the Centroid of these surfaces? see this update V2

Attachments:

The one you made is the line normal to the centre or the surface. I'd need the line representing the centre of all the surfaces connected in a common vertex (like the pole of an umbrella, but more difficult if the pyramid is not regular - as the one previously attached) 

Ah...but that is the "centroid of vectors" - my dear Watson (each one defined at 0/1 for each surface edge, see inside C# about how the other vectors are defined)  and has nothing to do with ..er...hmm... a "multi-cross-product" (but I'm working to invent that one: Math Nobel prize on hand, I do hope, he he).

1. Get this "tutorial" (play with the 2nd C#):

In plain English:

Is this what are you after? (the umbrella stick, that is).

2. Explain in detail what is your final goal > it's very easy to replace all that things with ONE C# that gets a surface List (or Tree) > ... > does things > ... > gives you anything you want.

best, Peter

Attachments:

PS: Obviously we need some extension on that "demo" V2 C# provided:

forget Lunchbox, divide a surface, decide pattern mode and then do whatever with points, surfaces, breps, cats, dogs, vectors ...etc etc.

Why may you ask? Well ... in order to work with complete control with your modules (triangles in this case) we need a proper Data Tree (where u is the branch index and v is the item index). That way accessing anything ("orphan" triangles etc etc) is a piece of cake.

PS: that said this MIA vector (the umbrella stick) is the normal at some (u,v) on the "donor" surface (the one that is triangulated) ... so what's the issue actually here?

more soon, best Peter 

Peter,

thank you for all these information. Very helpful, especially for my future definitions! :)

Honestly, at the moment, it's quite hard to follow all your script, because I'm very entry level in C (even less than entry level).

In term of "what is your final goal?", I need to put a node in a point of this vector (umbrella stick vector). Once I get the proper vector, the rest is already done (thanks to trigonometry).

According to your def, what exactly I have to put in ptList? How does it regognise what is the common vertex of each branch? I'm getting lost

Give me some minutes for a proper demo (start from a surface List > divide into mini surfaces > get some data >  ...).

ptList samples your test points - if you want to use some (otherwise they are randomly created).

Math Nobel prize on hand, I do hope [...]

It's called the Fields medal. I suppose it's no big deal to find the vector perpendicular to N input vectors, so long as you're allowed to arbitrarily add dimensions.

how d'ya like dem apples!

Hi David,

the issue is (except that I have to refresh my maths notes :) ) that if I use average, it works for some basic case (similar to a pyramid), otherwise it makes something odd.

Attached you see an example:

n.23 is quite good, but if you see n.11 it goes in a wrong direction.

Probably because of this scheme:

If I have a pyramid, of course the centre is the centre of the hexagon. But, even if I have some vector along some edge, the centre needs to stay still the same. In case of average of vector, this centre will be more shifted on the right.

Is it correct (or clear) what I'm saying?

Attachments:

Sorry for the delay (had serious issues with my doberman).

Get the all in one thing promised (you don't need Lunchbox - not to mention that provides modules in a List instead of a tree: makes further processing a bit of ...).

Note:

1. The umbrella sticks are the vectors from the classic surface subdivisions since every point belongs to that surface. Anyway I could very easily create (unitized) vectors on a per Brep Triangle basis and them sum them (see the "centroid" test def provided above) and then test them (Vector3d.VectorAngle(this,that) ) against the surf subdivision vectors blah blah.

2. Play with the available "triangle" Modes

3. Spend some time to get the gist of the sData System.Object tree that holds a myriad of things (instead of using a myriad of trees for each category of data). Of course you need to cast every thing back when accessing data.

best, Peter

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