<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Rotating a 3dPolyline in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3840198#M50109</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to rotate a 3dPolyline, so that I can check(view) the Z-value of vertices in the top-view mode.&lt;/P&gt;&lt;P&gt;The following is the example which I am trying to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="K-1.png" align="center" title="K-1.png" src="https://forums.autodesk.com/t5/image/serverpage/image-id/50201iEC0602C72F8A1F55/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The white 3dPolyline has vertices at each intersecting point with the contour lines.&lt;/P&gt;&lt;P&gt;Each vertax has Z-value.&lt;/P&gt;&lt;P&gt;I want to rotate this white 3dPolyline in 3D, so that I can make the red 2dPolyline. (Z-value becomes Y-value)&lt;/P&gt;&lt;P&gt;And the start point of the white 3dPolyline becomes the left most point of the red line.&lt;/P&gt;&lt;P&gt;The end point of the white 3dPolyline becomes the right most point of the red line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, I am doing this by making a new 2dPolyline, manually inserting Z-values as Y-values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it looks like my code can be neater if I use TrnasformBy(Matrix3d.Projection).&lt;/P&gt;&lt;P&gt;Sadly, I am not good with Geometry, so it's bit hard for me to figure out how to use this Matrix3d.Projection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone write me a quick code snippet to make this function? (preferably in C#)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Apr 2013 02:39:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-04-08T02:39:00Z</dc:date>
    <item>
      <title>Rotating a 3dPolyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3840198#M50109</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to rotate a 3dPolyline, so that I can check(view) the Z-value of vertices in the top-view mode.&lt;/P&gt;&lt;P&gt;The following is the example which I am trying to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="K-1.png" align="center" title="K-1.png" src="https://forums.autodesk.com/t5/image/serverpage/image-id/50201iEC0602C72F8A1F55/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The white 3dPolyline has vertices at each intersecting point with the contour lines.&lt;/P&gt;&lt;P&gt;Each vertax has Z-value.&lt;/P&gt;&lt;P&gt;I want to rotate this white 3dPolyline in 3D, so that I can make the red 2dPolyline. (Z-value becomes Y-value)&lt;/P&gt;&lt;P&gt;And the start point of the white 3dPolyline becomes the left most point of the red line.&lt;/P&gt;&lt;P&gt;The end point of the white 3dPolyline becomes the right most point of the red line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, I am doing this by making a new 2dPolyline, manually inserting Z-values as Y-values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it looks like my code can be neater if I use TrnasformBy(Matrix3d.Projection).&lt;/P&gt;&lt;P&gt;Sadly, I am not good with Geometry, so it's bit hard for me to figure out how to use this Matrix3d.Projection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone write me a quick code snippet to make this function? (preferably in C#)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2013 02:39:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3840198#M50109</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-08T02:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating a 3dPolyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3841349#M50110</link>
      <description>&lt;P&gt;can you post the DWG file maybe?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2013 22:15:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3841349#M50110</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2013-04-08T22:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating a 3dPolyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3842845#M50111</link>
      <description>&lt;P&gt;I found an another way around.&lt;/P&gt;&lt;P&gt;Rotating twice and displace it!! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Polyline3d pl3d = ent as Polyline3d;

double a = MyMath.GetAzimuth(pl3d.StartPoint, pl3d.EndPoint);
Matrix3d mat = Matrix3d.Rotation(a - (Math.PI / 2), new Vector3d(0, 0, 1), pl3d.StartPoint);                                        
pl3d.TransformBy(mat);

Matrix3d mat2 = Matrix3d.Rotation(3 * Math.PI / 2, new Vector3d(1, 0, 0), pl3d.StartPoint);
pl3d.TransformBy(mat2);

Vector3d v = new Vector3d(basePnt.X - pl3d.StartPoint.X, basePnt.Y - pl3d.StartPoint.Y, basePnt.Z - pl3d.StartPoint.Z);
Matrix3d mat3 = Matrix3d.Displacement(v);
pl3d.TransformBy(mat3);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time anyway~ &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2013 02:01:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3842845#M50111</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-10T02:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating a 3dPolyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3843023#M50113</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A little too late...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Point3d startPnt = pl3d.StartPoint;
Vector3d vect = pl3d.EndPoint - startPnt;
double angle = vect.GetAngleTo(Vector3d.XAxis, Vector3d.ZAxis);
pl3d.TransformBy(
    Matrix3d.Displacement(basePnt - startPnt) *
    Matrix3d.Rotation(Math.PI / -2.0, Vector3d.XAxis, startPnt) *
    Matrix3d.Rotation(angle, Vector3d.ZAxis, startPnt));&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2013 10:04:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3843023#M50113</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2013-04-10T10:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating a 3dPolyline</title>
      <link>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3871438#M50114</link>
      <description>&lt;P&gt;Didn't know I can write it this simple.&lt;BR /&gt;Thank you very much~!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2013 00:32:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/rotating-a-3dpolyline/m-p/3871438#M50114</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-15T00:32:53Z</dc:date>
    </item>
  </channel>
</rss>

