 # Rotate a polyline

Hello I’m trying to construct an architectural design with intersecting Polylines.

I create a rectangle using Polylines.

I now want to rotate it. I dont think I can rotate a set of polylines in one go.
Is it best to create a nurbs curve in order to rotate it? as per my C# code.

Thanks

Ed

expt.gh (3.4 KB)

private void RunScript(object x, object y, ref object A, ref object B)
{
Polyline P = makePolygon(10);
var nurbs = P.ToNurbsCurve();
//bool b = nurbs.MakeClosed(0.001);
nurbs.Rotate(Math.PI/4, Vector3d.ZAxis, new Point3d(0, 0, 0));
A = nurbs;
}

Polyline makePolygon(int sz)
{
Point3d pts = new Point3d; // An array of 4 points (vertices)for each polygon.
pts = new Point3d(0, 0, 0); pts = new Point3d(0, sz, 0); // These are the 4 vertices
pts = new Point3d(sz, sz, 0); pts = new Point3d(sz, 0, 0);
Polyline T = new Polyline(pts);
return T;
}
}

For all transformations in any geometry class, such as rotations, scale, planetoplane and others use transform method. Transform method is also static, so you can call typical matrix operations.

For instance:

``````  private void RunScript(object x, object y, ref object A, ref object B)
{
Polyline P = makePolygon(10);

P.Transform(Transform.Rotation(Math.PI / 4, Vector3d.ZAxis, new Point3d(0, 0, 0)));

A = P;

}``````

Great. Thanks for making it so simple Very grateful.