Search code examples
c#eyeshot

How to rotate a region in Eyeshot so that its plane normal is equal to a vector?


I need to draw a prism between 2 point. So I have defined a Region like this:

Region r1 = Region.CreateRectangle(Model.Width, Model.Height);
r1.Translate(point1);

Now I need to rotate r1 to face point2 and then do:

r1.ExtrudeAsMesh(distanceBetweenPoints, 0, Mesh.natureType.Plain);

But Eyeshot doesn't let me change the plane normal of r1 directly. Is there any way to achieve this (other than doing the math by hand)?


Solution

  • Hate to answer my own question, But I solved it like this:

    Vector3D theVector = new Vector3D(point1, point2);
    Plane thePlane = new Plane(point1, theVector);
    Region r1 = Region.CreateRectangle(thePlane, Model.Width, Model.Height, true);
    Mesh m1 = r1.ExtrudeAsMesh(theVector, 0, Mesh.natureType.Plain);