<?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 Intersection of 2 Hatch in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/intersection-of-2-hatch/m-p/1237963#M27505</link>
    <description>Hello,
Is there a way to know if one hatch intersects with another hatch?
Thanks in advance,
Helio.</description>
    <pubDate>Tue, 01 Feb 2005 13:01:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-02-01T13:01:55Z</dc:date>
    <item>
      <title>Intersection of 2 Hatch</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/intersection-of-2-hatch/m-p/1237963#M27505</link>
      <description>Hello,
Is there a way to know if one hatch intersects with another hatch?
Thanks in advance,
Helio.</description>
      <pubDate>Tue, 01 Feb 2005 13:01:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/intersection-of-2-hatch/m-p/1237963#M27505</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-02-01T13:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection of 2 Hatch</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/intersection-of-2-hatch/m-p/1237964#M27506</link>
      <description>The only way I have found is obtainig the loops and intersecting them
(Thanks Ing. B.C.).

This is my code snippet. It only works when the number of Loops are equal
and loops are built from lines. This is enough for me.

I dont know if there is a simply way to do the same. Any suggestions?

bool IntersectionOf2Hatch(AcDbHatch *pHatch1, AcDbHatch *pHatch2)
{
/* Return:
    true: Found an intersection
    false: no intersections
*/

 int loops1 = pHatch1-&amp;gt;numLoops();
 int loops2 = pHatch2-&amp;gt;numLoops();

 AcDbObjectIdArray loopIds1;
 AcDbObjectIdArray loopIds2;
 for (int i = 0; i &amp;lt; loops1; ++i) {
   long loopType1;
  AcGeVoidPointerArray edgePtrs1;
  AcGeIntArray edgeTypes1;
  long loopType2;
  AcGeVoidPointerArray edgePtrs2;
  AcGeIntArray edgeTypes2;
  AcDb3dPolyline *pPol1 = NULL;
  AcDb3dPolyline *pPol2 = NULL;

  if (pHatch1-&amp;gt;getLoopAt(i, loopType1, edgePtrs1, edgeTypes1) == Acad::eOk)
{
   for (int j = 0; j &amp;lt; edgePtrs1.length(); j++) {
    AcGePoint3d point1;

    switch (edgeTypes1&lt;J&gt;){
    case AcDbHatch::kLine: {
     AcGeLineSeg3d *pGeLine3d = (AcGeLineSeg3d*)edgePtrs1&lt;J&gt;;
     point1 = pGeLine3d-&amp;gt;startPoint();
     AcDb3dPolylineVertex *pVertex = new AcDb3dPolylineVertex(point1);
     if (pPol1 == NULL)
      pPol1 = new AcDb3dPolyline();
     pPol1-&amp;gt;appendVertex(pVertex);
     }
     break;
    case AcDbHatch::kCirArc:
    case AcDbHatch::kEllArc:
    case AcDbHatch::kSpline:
    default:
     break;
    }
   }
   if (pPol1 != NULL)
    pPol1-&amp;gt;makeClosed();
  }
  if (pHatch2-&amp;gt;getLoopAt(i, loopType2, edgePtrs2, edgeTypes2) == Acad::eOk)
{
   for (int k = 0; k &amp;lt; edgePtrs2.length(); k++) {
    AcGePoint3d point2;

    switch (edgeTypes2&lt;K&gt;){
    case AcDbHatch::kLine: {
     AcGeLineSeg3d *pGeLine3d = (AcGeLineSeg3d*)edgePtrs2&lt;K&gt;;
     point2 = pGeLine3d-&amp;gt;startPoint();
     AcDb3dPolylineVertex *pVertex = new AcDb3dPolylineVertex(point2);
     if (pPol2 == NULL)
      pPol2 = new AcDb3dPolyline();
     pPol2-&amp;gt;appendVertex(pVertex);
     }
     break;
    case AcDbHatch::kCirArc:
    case AcDbHatch::kEllArc:
    case AcDbHatch::kSpline:
    default:
     break;
    }
   }
   if (pPol2 != NULL)
    pPol2-&amp;gt;makeClosed();
  }
  if (pPol1 != NULL &amp;amp;&amp;amp; pPol2 != NULL) {
   AcGePoint3dArray points;
   if (pPol1-&amp;gt;intersectWith(pPol2, AcDb::kOnBothOperands, points) ==
Acad::eOk) {
        if (points.length() &amp;gt; 0) {
        delete pPol1;
        delete pPol2;
        return true;
    }
   }
  }
  if (pPol1 != NULL)
   delete pPol1;
  if (pPol2 != NULL)
   delete pPol2;
 }

 return false;
}


"developer" &lt;DESARROLLO&gt; escribió en el mensaje
news:41ff7ef0$1_1@newsprd01...
&amp;gt; Hello,
&amp;gt; Is there a way to know if one hatch intersects with another hatch?
&amp;gt; Thanks in advance,
&amp;gt; Helio.
&amp;gt;
&amp;gt;&lt;/DESARROLLO&gt;&lt;/K&gt;&lt;/K&gt;&lt;/J&gt;&lt;/J&gt;</description>
      <pubDate>Thu, 03 Feb 2005 12:01:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/intersection-of-2-hatch/m-p/1237964#M27506</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-02-03T12:01:38Z</dc:date>
    </item>
  </channel>
</rss>

