Grasshopper

algorithmic modeling for Rhino

Hi, I am quite new in C#

I am trying to create some simple boids script and I do not know how to move points (and other geometry). How do I use Transform and Translate to move them with Vector3d?

I have something like this

Vector3d vectemp = boids[i];
ruch = Rhino.Geometry.Transform.Translation(vectemp);

Point3d pttemp = agenci[i];
Point3d ruszony = new Point3d(agenci[i].Transform(ruch));

Views: 1430

Replies to This Discussion

Points are easy to move.

Vector3d vectemp = boids[i];

Point3d pttemp = agenci[i];

pttemp += vectemp;

or

agenci[i] = agenci[i] + boids[i]

Thanks!

But how with other geometry? Crvs, breps etc.?

Point3d and Vector3d are not like other types of geometry, but it tends to work in roughly the same way everywhere. Transformations can be applied using the RhinoCommon Transform matrix type. A transform matrix is usually used in conjunction with a Transform method:

Transform motion = Transform.Translation(vectorMotion);

Point3d point = ...;

point.Transform(motion);

the last line will modify the point. 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service