<?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: AcGeCircArc2d problem with tangent function in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030774#M10387</link>
    <description>&lt;P&gt;I've added the tangent on&amp;nbsp;p2; if the arc is drawed from p1 to p2, why tangent are in the p2-p1 direction?&lt;/P&gt;&lt;P&gt;This was the original question, not how to draw an arc from an AcGeCircArc2dentity...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for my english;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Massimo Conficconi&lt;/P&gt;</description>
    <pubDate>Tue, 09 Feb 2016 11:23:13 GMT</pubDate>
    <dc:creator>mconficconi</dc:creator>
    <dc:date>2016-02-09T11:23:13Z</dc:date>
    <item>
      <title>AcGeCircArc2d problem with tangent function</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6022070#M10385</link>
      <description>&lt;P&gt;AcGePoint2d&amp;nbsp;&lt;SPAN&gt;p2d01(0.73418800649031368,17.848733056886374);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AcGePoint2d&amp;nbsp;p2d02(-61.740762501740704,-4.9277122828104929);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;double&amp;nbsp;dBulge=0.19787629562480538;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;AcGeCircArc2d ca2dCCW(p2d01, p2d02, dBulge, Adesk::kFalse);&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AcGeLine2d l2dTg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ca2dCCW.tangent(p2d01, l2dTg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AcGeVector2d v2dDzTg=l2dTG.direction();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;v2dDzT&lt;SPAN&gt;g is in the wrong way; the triangle &lt;SPAN&gt;ca2dCCW.center(),&amp;nbsp;p2d01,&amp;nbsp;p2d01+v2dDzTg is clock&amp;nbsp;wise, but the arc is counter clock wise&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this an error, or i'm not understund how&amp;nbsp;tangent work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thank's in advance&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 15:29:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6022070#M10385</guid>
      <dc:creator>mconficconi</dc:creator>
      <dc:date>2016-02-03T15:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: AcGeCircArc2d problem with tangent function</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030556#M10386</link>
      <description>&lt;P&gt;I suppose you have been confused by the &lt;FONT face="courier new,courier"&gt;AcGeCircArc2d&lt;/FONT&gt; object because you didn't consider &lt;FONT face="courier new,courier"&gt;AcGeCircArc2d::refVec()&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;The code below shows what I mean. I have renamed your variables for better readability but took the same values.&lt;/P&gt;&lt;P&gt;The function just creates an &lt;FONT face="courier new,courier"&gt;AcDbArc&lt;/FONT&gt; from the &lt;FONT face="courier new,courier"&gt;AcGeCircArc2d,&lt;/FONT&gt; an &lt;FONT face="courier new,courier"&gt;AcDbLine&lt;/FONT&gt; for the tangent and another&amp;nbsp;&lt;FONT face="courier new,courier"&gt;AcDbLine&lt;/FONT&gt; between the arc's start- and endpoint. Note the value &lt;FONT face="courier new,courier"&gt;refAng = arc.refVec().angle()&lt;/FONT&gt;. If you don't add this value to the start-/endangle you'll get a misplaced arc!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;void cmdTangent()
{
	AcGePoint2d p1(0.73418800649031368,17.848733056886374);
	AcGePoint2d p2(-61.740762501740704,-4.9277122828104929);
	double dBulge = 0.19787629562480538;
	AcGeCircArc2d arc(p1, p2, dBulge, Adesk::kFalse);

	AcGeLine2d line;
	arc.tangent(p1, line);

	// Draw the arc
	AcGePoint3d P1(p1.x, p1.y, 0.0);
	AcGePoint3d P2(p2.x, p2.y, 0.0);
	AcGePoint2d c(arc.center());
	AcGePoint3d Center(c.x, c.y, 0.0);
	AcGeVector2d refvec(arc.refVec());	// &amp;lt;-- 
	double refAng = refvec.angle();		// &amp;lt;-- This is important!

	AcDbArc *pArc = new AcDbArc(
		Center,
		arc.radius(),
		refAng + arc.startAng(), // &amp;lt;--
		refAng + arc.endAng()	 // &amp;lt;--
	);
	Acad::ErrorStatus postToDb(AcDbEntity* pEnt);
	pArc-&amp;gt;setDatabaseDefaults();
	postToDb(pArc);

	// Draw the tangent line
	AcGePoint2d  pl = line.pointOnLine();
	AcGeVector2d dir = line.direction();
	AcGePoint3d pl1(pl.x, pl.y, 0.0);
	AcGeVector3d Dir(dir.x, dir.y, 0.0);

	AcDbLine *pTangentLine = new AcDbLine(pl1, pl1+Dir);
	pTangentLine-&amp;gt;setDatabaseDefaults();
	pTangentLine-&amp;gt;setColorIndex(1); // red
	postToDb(pTangentLine);


	// Draw a connection line between start- and endpoint
	AcDbLine *pStartToEndPtLine = new AcDbLine(P1, P2);
	pStartToEndPtLine-&amp;gt;setDatabaseDefaults();
	pStartToEndPtLine-&amp;gt;setColorIndex(3); // green
	postToDb(pStartToEndPtLine);
}

Acad::ErrorStatus postToDb(AcDbEntity* pEnt)
{
	Acad::ErrorStatus      es, es2;
	AcDbBlockTable*        pBlockTable = 0;
	AcDbBlockTableRecord*  pSpaceRecord = 0;

	if (!pEnt)
		return Acad::eNullEntityPointer;

	AcDbDatabase *pDb = acdbHostApplicationServices()-&amp;gt;workingDatabase();
	if ((es = pDb-&amp;gt;getBlockTable(pBlockTable, AcDb::kForRead)) != Acad::eOk)
		return es;

	if ((es = pBlockTable-&amp;gt;getAt(ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite)) == Acad::eOk)
	{
		AcDbObjectId objId;
		es = pSpaceRecord-&amp;gt;appendAcDbEntity(objId, pEnt);
		es2 = pSpaceRecord-&amp;gt;close();

		if (es == Acad::eOk)
		{
			es2 = pEnt-&amp;gt;downgradeOpen();
			es2 = pEnt-&amp;gt;draw();
			pEnt-&amp;gt;close();
		}
	}
	es2 = pBlockTable-&amp;gt;close();

	return es;
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Feb 2016 08:40:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030556#M10386</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2016-02-09T08:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: AcGeCircArc2d problem with tangent function</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030774#M10387</link>
      <description>&lt;P&gt;I've added the tangent on&amp;nbsp;p2; if the arc is drawed from p1 to p2, why tangent are in the p2-p1 direction?&lt;/P&gt;&lt;P&gt;This was the original question, not how to draw an arc from an AcGeCircArc2dentity...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for my english;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Massimo Conficconi&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 11:23:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030774#M10387</guid>
      <dc:creator>mconficconi</dc:creator>
      <dc:date>2016-02-09T11:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: AcGeCircArc2d problem with tangent function</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030908#M10388</link>
      <description>&lt;P&gt;Yep. Sorry. I should read questions more carefull &lt;img id="smileyembarrassed" class="emoticon emoticon-smileyembarrassed" src="https://forums.autodesk.com/i/smilies/16x16_smiley-embarrassed.png" alt="Smiley Embarassed" title="Smiley Embarassed" /&gt;.&lt;/P&gt;&lt;P&gt;The docs don't say anything about the tangent's direction. I agree with you - I would expect the other direction.&lt;/P&gt;&lt;P&gt;Maybe you should use this base class method instead of &lt;FONT face="courier new,courier"&gt;tangent()&lt;/FONT&gt;:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;AcGePoint2d AcGeCurve2d::evalPoint(double,int,AcGeVector2dArray&amp;amp;) const;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like this:&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AcGeVector2d dir2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;double param = 0.0;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (arc.isOn(p1))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;param = arc.paramOf(p1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;AcGePointOnCurve2d pntOnCrv;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;arc.getClosestPointTo(p1, pntOnCrv);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;param = pntOnCrv.parameter();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;AcGeVector2dArray derivArray;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;arc.evalPoint(param, 1, derivArray);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dir2 = derivArray[0];&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dir2.normalize();&lt;BR /&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;dir2&lt;/FONT&gt; should be guaranteed to point in the right direction.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 13:16:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030908#M10388</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2016-02-09T13:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: AcGeCircArc2d problem with tangent function</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030927#M10389</link>
      <description>&lt;P&gt;i'm already test the direction of the curve with the direction formed by center, point, point+direction; different direction imply the negate vector is needed...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 13:29:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030927#M10389</guid>
      <dc:creator>mconficconi</dc:creator>
      <dc:date>2016-02-09T13:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: AcGeCircArc2d problem with tangent function</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030935#M10390</link>
      <description>&lt;P&gt;The solution I presented above has the advantage to work for every &lt;FONT face="courier new,courier"&gt;AcGeCurve2d&lt;/FONT&gt;-derived object. So you don't need any class specific code to fix the direction. Use whatever makes you happy &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.autodesk.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2016 13:36:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/acgecircarc2d-problem-with-tangent-function/m-p/6030935#M10390</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2016-02-09T13:36:19Z</dc:date>
    </item>
  </channel>
</rss>

