Grasshopper

algorithmic modeling for Rhino

There's anyone can tell ne how work the matrix comand? If i have a 15 cube in the model space can i obtain a matrix of they position? (Rotation,traslation)
Sorry for my english
Thanks a lot

Views: 6470

Replies to This Discussion

Hi Daniel,

are you talking about storing data in a matrix, about transformation matrices or about the new matrix data type?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I think the first option but my english is not good and maybe i don t undestand very well!!
If you know the software OCTANE RENDER and the method of management of instance maybe you can understand very well what I'm talking about...thanks a lot
Hello David ... your silence is due to the lack of no knowledge of instances of Octane Render right? Could you explain, if possible, the methods to get matrix from storing data?
Thanks a lot!

I think I forgot about this discussion. Sorry. I am not familiar with Octane (other than knowing it exists).

I deduce from you mentioning "management of instance[s]" that you are talking about transformation matrices. I.e. 4x4 matrices that encode translation, rotation (including partial rotation aka shearing), scaling and tapering. 

If you are asking how to create a transformation matrix given two instances of an object, I think your best bet is to use the ChangeBasis method the RhinoCommon Transform type. It allows you to construct a transformation matrix that maps from one base-plane to another. In the process encoding both translation, rotation and even scaling. It does require you have a method of constructing a consistent base-plane given the shape. I wrote a small script that creates a Brep frame consistently from the brep vertices (see attached).

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:
Thanks a lot sunday i try this script....for the moment thanks thanks!! I contact you if i need help ok??!
Great

ps, my script does not do scaling. Haven't tried adding that. If you have further questions, please post them here if at all possible, that way I won't have to answer the same question twice were it to come up again in the future.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David,as I told you, I'll try your script Sunday, but I will try to explain what I need:
When I create a copy, has a position with respect to the origin, which must be defined by a matrix to twelve numbers.
In the Forum of OctaneRender, one of the developers explained the istance and the creation of the matrix in this way:
Node Scatter: creates multiple instances, given a list of transform matrices. A matrix is given as 12 numbers, which are the first three rows of the transformation matrix. They are given in row
major order.


The coordinates in a scatter node are given as the first three rows of the transformation matrices (the fourth is always [0, 0, 0, 1]).

For instance the matrix for a 30° rotation around the Z axis looks like this:
[.87, –.50, 0, 0]
[.50, .87, 0, 0]
[ 0, 0, 1, 0]
[ 0, 0, 0, 1]

The scatter node will contain these 12 values:
.87 –.50 0 0 .50 .87 0 0 0 0 1 0

For a translation:
[1, 0, 0, tx]
[0, 1, 0, ty]
[0, 0, 1, tz]
[0, 0, 0, 1]

The scatter node will contain these 12 values:
1 0 0 tx 0 1 0 ty 0 0 1 tz

The intent is that these values will get exported from modeling applications.

There is also a placement node, that has one transform input and one geometry input, and this one transform is given as a transform node (translation, rotation, scale). The sierpinski demo scene was built with these nodes.

I hope this might help!

The coordinates in a scatter node are given as the first three rows of the transformation matrices (the fourth is always [0, 0, 0, 1]).

Yes, the fourth column of the fourth row is always 1.0. The first three numbers in the fourth row however represent a tapering transformation. This is mostly used in perspective deformations, so it's understandable that it would not be used for instancing objects in 3D space.

Creating a 'scatter node' from a Rhino transform matrix is a piece of cake, at least in code. The only remaining question is: "what data type is the scatter node?". Is it a single piece of text with numbers and spaces (numbers formatted using the local culture or do they always use points as decimal symbols?). Is it an array of single or double precision floating point values? Is it a byte-stream with encoded floats?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

far as I understand from your question, the 'only thing I can tell you is that the result is a series of twelve numbers with three decimal numbers separated by a comma .... example: 1.253, 5.552, 0.521, 6.888, 0, etc... .........

This is what you asked me?

Great

Yes, I need to know in what format to supply the data so that it can be used by the other software in this dance. I updated the file to include a matrix -> string formatter.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:
thanks a lot I do not know how to thank you ... I will try to experiment and I hope not to bother you any more, but do not count on it! thank you very much
an information: Which version of grasshopper should I use?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service