<?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 Re: Draw an arc between two points with a center in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890848#M9217</link>
    <description>I am starting to notice there is something wrong with your solution, it always draws a semi-circle and doesnt react well to where the endpoint is, some kind of bug in AutoCAD? you should try it</description>
    <pubDate>Wed, 12 Apr 2023 14:58:54 GMT</pubDate>
    <dc:creator>adrian_sieradzki</dc:creator>
    <dc:date>2023-04-12T14:58:54Z</dc:date>
    <item>
      <title>Draw an arc between two points with a center</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890332#M9211</link>
      <description>&lt;P&gt;Hi there I can't figure out how to use the arc constructor to create arc between two points&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public static Arc CreateArcFromCenterAndTwoPoints(Point3d center, Point3d startPoint, Point3d endPoint)
        {
            var referenceVector = new Vector3d(0, -1, 0);
            var startAngle = (startPoint - center).GetAngleTo(referenceVector, Vector3d.ZAxis);
            var endAngle = (endPoint - center).GetAngleTo(referenceVector, Vector3d.ZAxis);

            var arc = new Arc(center, center.DistanceTo(startPoint), startAngle, endAngle);


            return arc;
        }&lt;/LI-CODE&gt;&lt;P&gt;When I draw arc in autocad the reference vector points straight down and angle is counted counter-clockwise from there, when I try to code this nothing works I get random arcs in random places with random lengths.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 12:07:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890332#M9211</guid>
      <dc:creator>adrian_sieradzki</dc:creator>
      <dc:date>2023-04-12T12:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Draw an arc between two points with a center</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890620#M9212</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;If I do not misunderstand the goal, this should work:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        public static Arc CreateArcFromCenterAndTwoPoints(Point3d center, Point3d startPoint, Point3d endPoint)
        {
            var startVector = startPoint - center;
            var endVector = endPoint - center;
            var startAngle = Vector3d.XAxis.GetAngleTo(startVector, Vector3d.ZAxis);
            var endAngle = Vector3d.XAxis.GetAngleTo(endVector, Vector3d.ZAxis);

            return new Arc(center, startVector.Length, startAngle, endAngle);
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Apr 2023 13:50:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890620#M9212</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-04-12T13:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Draw an arc between two points with a center</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890657#M9213</link>
      <description>&lt;P&gt;Thanks for pointing in the right direction. You are AutoCAD king&lt;BR /&gt;&lt;BR /&gt;It ends up being&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static Arc CreateArcFromCenterAndTwoPoints(Point3d center, Point3d startPoint, Point3d endPoint)
        {
            var startVector = startPoint - center;
            var endVector = endPoint - center;
            var startAngle = Vector3d.XAxis.GetAngleTo(startVector, Vector3d.ZAxis);
            var endAngle = Vector3d.XAxis.GetAngleTo(endVector, Vector3d.ZAxis) - Math.PI;

            return new Arc(center, startVector.Length, startAngle, endAngle);
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Apr 2023 14:05:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890657#M9213</guid>
      <dc:creator>adrian_sieradzki</dc:creator>
      <dc:date>2023-04-12T14:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Draw an arc between two points with a center</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890725#M9214</link>
      <description>&lt;P&gt;I still observe something weird with this. Looks like end point of my arc is moving around as I move the center, which I cannot expain since center is always the same distance from both points..&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 14:24:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890725#M9214</guid>
      <dc:creator>adrian_sieradzki</dc:creator>
      <dc:date>2023-04-12T14:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Draw an arc between two points with a center</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890769#M9215</link>
      <description>&lt;P&gt;You do not show how you use this method (i.e. how do you get the 3 points).&lt;/P&gt;
&lt;P&gt;In this method the radius is the distance between the center and the start point. The end point is only used to get the end angle.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 14:37:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890769#M9215</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-04-12T14:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Draw an arc between two points with a center</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890783#M9216</link>
      <description>&lt;LI-CODE lang="general"&gt;CreateArcFromCenterAndTwoPoints(centerPoint, innerStartPoint, innerEndPoint )


I dont see how moving the centerPoint around should change where my arc ends, but this happens. &lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Apr 2023 14:40:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890783#M9216</guid>
      <dc:creator>adrian_sieradzki</dc:creator>
      <dc:date>2023-04-12T14:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Draw an arc between two points with a center</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890848#M9217</link>
      <description>I am starting to notice there is something wrong with your solution, it always draws a semi-circle and doesnt react well to where the endpoint is, some kind of bug in AutoCAD? you should try it</description>
      <pubDate>Wed, 12 Apr 2023 14:58:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11890848#M9217</guid>
      <dc:creator>adrian_sieradzki</dc:creator>
      <dc:date>2023-04-12T14:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Draw an arc between two points with a center</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11891054#M9218</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13443742"&gt;@adrian_sieradzki&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;I am starting to notice there is something wrong with your solution, it always draws a semi-circle&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I do not think there's something wrong. An AutoCAD Arc entity is a "semi-circle", and this is what you create in the first code you posted.&lt;BR /&gt;An arc is defined by a center, a radius, a normal, a start angle and an end angle. If you specify the center and the start point, the end point have to at the same distance of the center than the start point. As I said upper, the supplied end point is only used to get the end angle direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the distance from center to start point is different from the one to end point, may be you wnat to draw an elliptical arc. in this case center, start and end points are not sufficient data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 16:19:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11891054#M9218</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-04-12T16:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Draw an arc between two points with a center</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11891063#M9219</link>
      <description>If you want the arc still passes through the 2 points (or ends at the 2 points) while moving the center point, the center point MUST BE MOVED to keep the same distance to the 2 points (i.e. a long a line that divides the arc's angle evenly). That is, you CANNOT freely move the center and have the 2 points always on the arc.&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Apr 2023 16:22:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-an-arc-between-two-points-with-a-center/m-p/11891063#M9219</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-04-12T16:22:43Z</dc:date>
    </item>
  </channel>
</rss>

