Author Topic: INSIDEPT - Question  (Read 13522 times)

0 Members and 1 Guest are viewing this topic.

LE

  • Guest
INSIDEPT - Question
« on: March 17, 2006, 11:27:44 PM »
Here is another exercise, in this case is to port an autolisp/vlisp code into ARX from this one:

http://www.theswamp.org/index.php?topic=7785.msg98761#msg98761

Here is my code, please have a look and if possible run some tests and also all the adviced as always is welcome!

Thanks.

Code: [Select]
#include <vector>
#include <math.h>
#include <stdlib.h>

double minimumValue(vector<double> &distances)
{
int length=distances.size();
double minvalue=distances.at(0);
for(int i=1; i<length; i++)
{
if(distances.at(i) < minvalue) {
minvalue=distances.at(i);
}
}
return minvalue;
}

/////////////////

double delta (double a1, double a2) {
double ang;
if (a1 > (a2 + PI)) {
ang = ((a2 + PI + PI) - a1);
}
if (a2 > (a1 + PI)) {
ang = (a2 - a1 - PI - PI);
}
if (!(a1 > (a2 + PI)) && !(a2 > (a1 + PI))) {
ang = (a2 - a1);
}
return ang;
}

/////////////////

int isInside () {
ads_name ename;
ads_point ptres;
Acad::ErrorStatus es;
if (acedEntSel("\nSelect POLYLINE:", ename, ptres) == RTNORM) {

AcDbObjectId objId;
acdbGetObjectId(objId, ename);
AcDbObjectPointer<AcDbPolyline> pPoly( objId, AcDb::kForRead );

if ((es = pPoly.openStatus()) == Acad::eOk) {

// select test point
ads_point tstpt;
if (acedGetPoint(NULL, "\nTest point: ", tstpt) == RTNORM) {

if (pPoly->isClosed()) {

AcGePoint3d Start;
pPoly->getStartPoint(Start);

struct resbuf fromrb, torb;
fromrb.restype = RTSHORT;
fromrb.resval.rint = 1; 
torb.restype = RTSHORT;
torb.resval.rint = 0;

acedTrans(tstpt, &fromrb, &torb, FALSE, tstpt);

AcGePoint3d pt;
pt.set(tstpt[X], tstpt[Y], tstpt[Z]);

AcGePoint3d ClosestPoint;
pPoly->getClosestPointTo(pt, ClosestPoint);

if (pt.isEqualTo(ClosestPoint)) {
return RSERR;
}

double ClosestParam, End;
pPoly->getParamAtPoint(ClosestPoint, ClosestParam);
pPoly->getEndParam(End);

fromrb.restype = RTSHORT;
fromrb.resval.rint = 0; 
torb.restype = RTSHORT;
torb.resval.rint = 1;

ads_point topt;
acedTrans(asDblArray(ClosestPoint), &fromrb, &torb, FALSE, topt);

double Sample=0.2, P1=0.0, P2=Sample, Defl=0.0, a1, a2;

fromrb.restype = RTSHORT;
fromrb.resval.rint = 0; 
torb.restype = RTSHORT;
torb.resval.rint = 1;

ads_point tpt;
acedTrans(asDblArray(Start), &fromrb, &torb, FALSE, tpt);

a1 = acutAngle(tstpt, tpt);

while (P2 <= End) {
////if (P2 < End) {
//// P2 = P2;
////} else {
//// P2 = End;
////}

vector<double> distances;
distances.push_back(P2);
distances.push_back(End);
P2=minimumValue(distances);

if ((P1 < ClosestParam) && (P1 < P2)) {
a2 = acutAngle(tstpt, topt);
Defl = delta(a1,a2);
a1 = a2;
}

AcGePoint3d P;
while (pPoly->getPointAtParam(P2, P) != Acad::eOk) {
P2 = (P2 + Sample);
}// end of while

fromrb.restype = RTSHORT;
fromrb.resval.rint = 0; 
torb.restype = RTSHORT;
torb.resval.rint = 1;

ads_point Pt;
acedTrans(asDblArray(P), &fromrb, &torb, FALSE, Pt);

a2 = acutAngle(tstpt, Pt);
Defl = (Defl + delta(a1,a2));
a1 = a2;
P1 = P2;
P2 = (P2 + Sample);

}// end of while

if (abs(Defl) > 4) {
acutPrintf( "\nPoint inside.");
} else {
acutPrintf( "\nPoint outside.");
}

}//end of if isClosed
}// end of if acedGetPoint
} else {
acutPrintf("\nIt is not a POLYLINE or it can not be opened: %s",
acadErrorStatusText( es ) );
}
}
}

/////////////////

static void LESQsomefunctions_INSIDEPT(void)
{
isInside();
}

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: INSIDEPT - Question
« Reply #1 on: March 18, 2006, 12:23:49 AM »
I am loath to comment on the code, cause I'm not a CPP programmer  ..

but, functionally,

would the functionality be better if split into 2 methods ? ; one to extract the vertex points , and one which is passed the vertex point list and the point in question. If this were done, the routine could be used in the case where there is no actual physical polyline.

regards
kwb
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #2 on: March 18, 2006, 04:16:25 AM »
Simple solution with help of AcDbMPolygon class:
Code: [Select]
enum Status {
  Outside  = -1,  // Point out of contour
  On       =  0,  // Point on contour
  Inside   =  1,  // Point inside contour
  Error    = -99  // Error
};

//////////////////////////////////////////////////////////////////////////
//       is_point_in_curve(AcGePoint3d p, AcDbCurve *pCurv)
//      -----------------------------------------------------
//  Parameters:
//    p      - testing point
//    pCurv  - testing curve (only AcDbPolyline or AcDb2dPolyline or AcDbCircle)
//
//  Return value:
//    Outside  = -1, // Point out of contour
//    On       =  0, // Point on contour   
//    Inside   =  1, // Point inside contour
//    Error    = -99 // Error             
//
//////////////////////////////////////////////////////////////////////////

inline Status is_point_in_curve(AcGePoint3d p, AcDbCurve *pCurv)
{
  double fuzz = AcGeContext::gTol.equalPoint();
  AcGePoint3d pointOnCurve;
  pCurv->getClosestPointTo(p,pointOnCurve);
  if (p.distanceTo(pointOnCurve) <= fuzz) return On;
  AcDbPolyline   *pPoly   = AcDbPolyline::cast(pCurv);
  AcDb2dPolyline *p2Poly  = AcDb2dPolyline::cast(pCurv);
  AcDbCircle     *pCircle = AcDbCircle::cast(pCurv);
  AcDbMPolygon mpol;
  if (pPoly) {
    if (mpol.appendLoopFromBoundary(pPoly)   != Acad::eOk) return Error;
  } else if (p2Poly) {
    if (mpol.appendLoopFromBoundary(p2Poly)  != Acad::eOk) return Error;
  } else if (pCircle) {
    if (mpol.appendLoopFromBoundary(pCircle) != Acad::eOk) return Error;
  } else
    return Error; // Invalid entity
  AcGeIntArray ar;
  if (mpol.isPointInsideMPolygon(p,ar) > 0) return Inside;
  else return Outside;
}
« Last Edit: March 18, 2006, 04:28:11 AM by Rivilis »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: INSIDEPT - Question
« Reply #3 on: March 18, 2006, 04:45:02 AM »
Alexander,
Does the

isPointInsideMPolygon()
 ?
work for a crossover polygon ;  example : figure 8
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #4 on: March 18, 2006, 04:53:17 AM »
Alexander,
Does the

isPointInsideMPolygon()
 ?
work for a crossover polygon ;  example : figure 8
No.  For crossover polygon mpol.appendLoopFromBoundary(pCircle) return Acad::eAmbiguousInput


Oops! With this changes this function also working with crossover polygon:

Code: [Select]
  inline Status is_point_in_curve(AcGePoint3d p, AcDbCurve *pCurv)
  {
    double fuzz = AcGeContext::gTol.equalPoint();
    AcGePoint3d pointOnCurve;
    pCurv->getClosestPointTo(p,pointOnCurve);
    if (p.distanceTo(pointOnCurve) <= fuzz) return On;
    AcDbPolyline   *pPoly   = AcDbPolyline::cast(pCurv);
    AcDb2dPolyline *p2Poly  = AcDb2dPolyline::cast(pCurv);
    AcDbCircle     *pCircle = AcDbCircle::cast(pCurv);
    AcDbMPolygon mpol;
    if (pPoly) {
      if (mpol.appendLoopFromBoundary(pPoly,false)   != Acad::eOk) return Error;
    } else if (p2Poly) {
      if (mpol.appendLoopFromBoundary(p2Poly,false)  != Acad::eOk) return Error;
    } else if (pCircle) {
      if (mpol.appendLoopFromBoundary(pCircle,false) != Acad::eOk) return Error;
    } else
      return Error; // Invalid entity
    AcGeIntArray ar;
    if (mpol.isPointInsideMPolygon(p,ar) > 0) return Inside;
    else return Outside;
  }

« Last Edit: March 18, 2006, 05:02:28 AM by Rivilis »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: INSIDEPT - Question
« Reply #5 on: March 18, 2006, 05:03:01 AM »
Thanks :-)
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

LE

  • Guest
Re: INSIDEPT - Question
« Reply #6 on: March 18, 2006, 11:00:56 AM »
Hi Alex;

Very good sample...

Now, please if you can, in AutoCAD draw any closed polyline or circle, call the command UCS and the option OBJect.

Then, call your routine and select the object and the test point, what are the results?


Thanks!

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #7 on: March 18, 2006, 11:49:32 AM »
Now, please if you can, in AutoCAD draw any closed polyline or circle, call the command UCS and the option OBJect.
Then, call your routine and select the object and the test point, what are the results?
Hi, Luis! This function working well in any UCS, but you must understand, that point parameter p must be in WCS and
must be projected on plan of contour:
Code: [Select]
static void CurvePointInCurve(void)
{
  ads_name en;
  AcGePoint3d p;
  Acad::ErrorStatus es;
  AcDbObjectId objId;
  AcDbCurve *pEnt = NULL;
  if (acedEntSel("\nSelect curve: ",en,asDblArray(p)) != RTNORM) return;
  if (acedGetPoint(NULL,"\nPick testing point: ",asDblArray(p)) != RTNORM) return;
  if (acdbGetObjectId(objId,en) != Acad::eOk) return;
  acdbUcs2Wcs(asDblArray(p),asDblArray(p),false);
  AcDbObjectPointer<AcDbCurve> pCurv(objId,AcDb::kForRead);
  if (pCurv.openStatus() == Acad::eOk) {
    AcGeVector3d vDir = AcGeVector3d::kZAxis;
    resbuf rb; acedGetVar("viewdir",&rb); // View direction
    vDir = asVec3d(rb.resval.rpoint);
    AcDb::Planarity plan_type;
    AcGePlane plane;   pCurv->getPlane(plane,plan_type);
    p = p.project(plane,vDir); // Project point on curve plan
    Status st = is_point_in_curve(p,pCurv.object());
    switch(st) {
      case Inside:  acutPrintf("\nInside!"); break;
      case Outside: acutPrintf("\nOutside!"); break;
      case On:      acutPrintf("\nOn!"); break;
      default:      acutPrintf("\nError!"); break;
    }
  }
}


LE

  • Guest
Re: INSIDEPT - Question
« Reply #8 on: March 18, 2006, 12:04:03 PM »
I was just trying to be picky.... you know... he he

It works as expected... !

Thanks, now I know why you work for MAESTRO.... you are one...  :kewl:

. . .

Have fun.
« Last Edit: March 19, 2006, 01:19:46 PM by LE »

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #9 on: March 18, 2006, 12:19:34 PM »
Alex, if you can, and have some free time, please test GBPOLY, I would like to hear from a master like you.
:) Ok! And if you can, and have some time, please look at this topic: http://www.theswamp.org/index.php?topic=9133.0
As I've understood, before writing arx-program, you were lisp-programmer. Is it true?


LE

  • Guest
Re: INSIDEPT - Question
« Reply #10 on: March 18, 2006, 12:29:57 PM »
Alex, if you can, and have some free time, please test GBPOLY, I would like to hear from a master like you.
:) Ok! And if you can, and have some time, please look at this topic: http://www.theswamp.org/index.php?topic=9133.0
As I've understood, before writing arx-program, you were lisp-programmer. Is it true?



Yes, I have tested your sample for the DYN_TEST command, very good, I like the ability of having in lisp the grread, not loosing the dragging, something not possible in plain autolisp as far as I know...

I am fairly new with ARX just about 14 or 15 months now, most of the previous code I did was ADS or half-half ADS/ARX... I am now in the route to learn more about just plain ARX... as you can see I'm still in diapers...  :-)

Yes I used to write a lot in lisp....

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #11 on: March 18, 2006, 01:00:33 PM »
Yes, I have tested your sample for the DYN_TEST command, very good, I like the ability of having in lisp the grread, not loosing the dragging, something not possible in plain autolisp as far as I know...
Yes. In plain autolisp you can not use object snap, menu, and many other things that you can use with this function. That is why I wrote this function.
I am fairly new with ARX just about 14 or 15 months now, most of the previous code I did was ADS or half-half ADS/ARX... I am now in the route to learn more about just plain ARX... as you can see I'm still in diapers...  :-)
I've began writing with C++ (ADS,ARX,ObjectARX) in AutoCAD R11 (in AutoCAD R10 I can only used AutoLisp)

P.S.: What about to make function which testing contour in contour? With help of class AcDbMPolygon it is not very difficult. :-)

LE

  • Guest
Re: INSIDEPT - Question
« Reply #12 on: March 18, 2006, 01:02:53 PM »
but, functionally,

the routine could be used in the case where there is no actual physical polyline.

Hi Kerry;

I would go the math route for that one, but we have masters on ARX now here, and it might be already something available in the ARX classes...

Arc/Curve data can be a problem... but it sound like an excellent exercise.... [do you have an specific case, where it would be needed something like this?]
« Last Edit: March 18, 2006, 01:05:57 PM by LE »

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #13 on: March 18, 2006, 01:09:46 PM »
but, functionally,
the routine could be used in the case where there is no actual physical polyline.
I think this code do it for any contour, which can be represent with array of vertexes and array of bulges.
If all bulges == 0.0 you need to create array of bulges which length is the length of vertexes array and
set zero value for every element of bulges array:

Code: [Select]
inline Status is_point_in_curve(AcGePoint3d p, AcGePoint2dArray &pts)
{
  AcDbMPolygon mpol;
  // If contour is not closed - close it!
  if (pts.first() != pts.last()) {
    pts.append(pts.first());
  }
  // Set  bulges for all vertexes to 0.0
  AcGeDoubleArray blgs; blgs.setLogicalLength(pts.length());
  for (int i=0; i<blgs.length(); i++) blgs[i]=0.0;
  if (mpol.appendMPolygonLoop(pts,blgs) != Acad::eOk) return Error;
  AcGeIntArray ar;
  if (mpol.isPointOnLoopBoundary(p,0)) return On;
  if (mpol.isPointInsideMPolygon(p,ar) > 0) return Inside;
  else return Outside;
}

inline Status is_point_in_curve(AcGePoint3d p, AcGePoint2dArray &pts, AcGeDoubleArray &blgs)
{
  AcDbMPolygon mpol;
  // If contour is not closed - close it!
  if (pts.first() != pts.last()) {
    pts.append(pts.first());
    blgs.append(0.0);
  }
  if (mpol.appendMPolygonLoop(pts,blgs,false) != Acad::eOk) return Error;
  AcGeIntArray ar;
  if (mpol.isPointOnLoopBoundary(p,0)) return On;
  if (mpol.isPointInsideMPolygon(p,ar) > 0) return Inside;
  else return Outside;
}
:)
« Last Edit: March 18, 2006, 01:44:17 PM by Rivilis »

LE

  • Guest
Re: INSIDEPT - Question
« Reply #14 on: March 18, 2006, 03:41:12 PM »
P.S.: What about to make function which testing contour in contour? With help of class AcDbMPolygon it is not very difficult. :-)

Maybe for you, you are master on C++/ARX  :-)

Here is one approach:

Code: [Select]
static void LESQsomefunctions_PINP(void)
{
ads_name en;
AcGePoint3d p;
Acad::ErrorStatus es;
AcDbObjectId objId1, objId2;
AcDbCurve *pEnt = NULL;
if (acedEntSel("\nSelect first curve: ",en,asDblArray(p)) != RTNORM) return;

if (acdbGetObjectId(objId1,en) != Acad::eOk) return;
AcDbObjectPointer<AcDbCurve> pCurv1(objId1,AcDb::kForRead);

if (acedEntSel("\nSelect second curve: ",en,asDblArray(p)) != RTNORM) return;

if (acdbGetObjectId(objId2,en) != Acad::eOk) return;
AcDbObjectPointer<AcDbCurve> pCurv2(objId2,AcDb::kForRead);

if ((pCurv1.openStatus() == Acad::eOk) &&
(pCurv2.openStatus() == Acad::eOk)) {

AcDbPolyline *pPoly1 = AcDbPolyline::cast(pCurv1.object());
AcDbPolyline *pPoly2 = AcDbPolyline::cast(pCurv2.object());

AcGePoint3dArray points;
es = pPoly1->intersectWith(pPoly2, AcDb::kOnBothOperands, points);
int len;
if ((es != Acad::eOk) || ((len = points.length()) == 0)) {

AcGePoint3d point;
double params;
unsigned int num = pPoly2->numVerts();

AcDbMPolygon mpol;
AcGeIntArray ar;

mpol.appendLoopFromBoundary(pPoly1,false);

long cont;
for (cont=0; cont < (num - 1); cont++) {
pPoly2->getPointAtParam((double)cont, point);
if (mpol.isPointInsideMPolygon(point, ar) > 0) {
acutPrintf("\nInside!");
} else {
acutPrintf("\nNOT Inside!");
}
}
} else {
acutPrintf("\nNOT Inside!");
}
}
}//end of command PINP

Kind of Mickey Mouse if you ask me.... he he

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #15 on: March 18, 2006, 04:16:10 PM »
It is my solution (without selecting entities):
Code: [Select]
namespace ContourContour {
  enum Status {
    Inside1         =  1,  // Contour 1 inside contour 2
    Inside2         =  2,  // Contour 2 inside contour 1
    Equal           =  3,  // Contours are equal
    Outside         =  4,  // Outside
    Intersect       =  0,  // Intersect
    SelfIntersect1  = -1,  // Contour 1 is selfcrossing
    SelfIntersect2  = -2,  // Contour 2 is selfcrossing
    Error           = -99  // Error
  };

 


  inline Status is_curve_in_curve(AcDbCurve *pCurv1, AcDbCurve *pCurv2, double fuzz)
  {
    Acad::ErrorStatus es;
    AcDbPolyline   *pPoly1   = AcDbPolyline::cast(pCurv1);
    AcDb2dPolyline *p2Poly1  = AcDb2dPolyline::cast(pCurv1);
    AcDbCircle     *pCircle1 = AcDbCircle::cast(pCurv1);
    AcDbPolyline   *pPoly2   = AcDbPolyline::cast(pCurv2);
    AcDb2dPolyline *p2Poly2  = AcDb2dPolyline::cast(pCurv2);
    AcDbCircle     *pCircle2 = AcDbCircle::cast(pCurv2);
    AcGePoint2dArray pts;
    AcGeDoubleArray  blg;
    // For optimizing:
    AcDbExtents exts1;  pCurv1->getGeomExtents(exts1);
    AcDbExtents exts2;  pCurv2->getGeomExtents(exts2);
    const double DD = AcGeContext::gTol.equalPoint();
    bool is_outer =
      (exts1.minPoint()[X] > exts2.maxPoint()[X]+2*DD) || (exts2.minPoint()[X] > exts1.maxPoint()[X]+2*DD) ||
      (exts1.minPoint()[Y] > exts2.maxPoint()[Y]+2*DD) || (exts2.minPoint()[Y] > exts1.maxPoint()[Y]+2*DD);
    if (is_outer) return Outside;

    // Are valid entities?
    if (!pPoly1 && !p2Poly1 && !pCircle1) return Error;
    if (!pPoly2 && !p2Poly2 && !pCircle2) return Error;

    // Testing contour 1 for selfcrossing
    AcDbMPolygon mpol1;
    if (pPoly1) {
      if ((es=mpol1.appendLoopFromBoundary(pPoly1,true,fuzz))   != Acad::eOk) return SelfIntersect1;
    } else if (p2Poly1) {
      if ((es=mpol1.appendLoopFromBoundary(p2Poly1,true,fuzz))  != Acad::eOk) return SelfIntersect1;
    } else if (pCircle1) {
      if ((es=mpol1.appendLoopFromBoundary(pCircle1,true,fuzz)) != Acad::eOk) return SelfIntersect1;
    }
    mpol1.getMPolygonLoopAt(0,pts,blg);
    // Testing contour 2 for selfcrossing
    AcDbMPolygon mpol2;
    if (pPoly2) {
      if ((es=mpol2.appendLoopFromBoundary(pPoly2,true,fuzz))   != Acad::eOk) return SelfIntersect2;
      if ((es=mpol1.appendLoopFromBoundary(pPoly2,true,fuzz))   != Acad::eOk) return Intersect;
    } else if (p2Poly2) {
      if ((es=mpol2.appendLoopFromBoundary(p2Poly2,true,fuzz))  != Acad::eOk) return SelfIntersect2;
      if ((es=mpol1.appendLoopFromBoundary(p2Poly2,true,fuzz))  != Acad::eOk) return Intersect;
    } else if (pCircle2) {
      if ((es=mpol2.appendLoopFromBoundary(pCircle2,true,fuzz)) != Acad::eOk) return SelfIntersect2;
      if ((es=mpol1.appendLoopFromBoundary(pCircle2,true,fuzz)) != Acad::eOk) return Intersect;
    }
    mpol2.appendMPolygonLoop(pts,blg,true,fuzz);
    // Testing for equal and insiding
    AcGeIntArray aIdx10,aIdx11,aIdx20,aIdx21;
    mpol1.getChildLoops(0,aIdx10); mpol1.getChildLoops(1,aIdx11);
    mpol2.getChildLoops(0,aIdx20); mpol2.getChildLoops(1,aIdx21);
    if (aIdx10.length()>0 && aIdx20.length()>0) return Equal;
    if (aIdx10.length()>0) return Inside2;
    if (aIdx11.length()>0) return Inside1;
    return Outside;
  }
};

//////////////////////////////////////////////////////////////////////////
//                   (is_curve_in_curve en1 en2 [fuzz])
///////////////////////////////////////////////////////////////////////////

static int ads_is_curve_in_curve(void)
{

  struct resbuf *pArgs = acedGetArgs () ;
  AcDbObjectId objId1,objId2;
  double fuzz = AcDbMPolygonCrossingFuzz;
  acedRetInt(ContourContour::Error);
  if (pArgs && pArgs->restype == RTENAME &&
      pArgs->rbnext && pArgs->rbnext->restype == RTENAME)    {
      if (acdbGetObjectId(objId1,pArgs->resval.rlname) == Acad::eOk &&
          acdbGetObjectId(objId2,pArgs->rbnext->resval.rlname) == Acad::eOk) {
          AcDbObjectPointer<AcDbCurve> pCurv1(objId1,AcDb::kForRead);
          AcDbObjectPointer<AcDbCurve> pCurv2(objId2,AcDb::kForRead);
          if (pCurv1.openStatus() == Acad::eOk && pCurv2.openStatus() == Acad::eOk) {
            if (pArgs->rbnext->rbnext && pArgs->rbnext->rbnext->restype == RTREAL) {
              fuzz = pArgs->rbnext->rbnext->resval.rreal;
            }
            ContourContour::Status i =
               ContourContour::is_curve_in_curve(pCurv1.object(),pCurv2.object(),fuzz);
            acedRetInt(i);
          }
        }
    }
    return (RSRSLT) ; 
}

LE

  • Guest
Re: INSIDEPT - Question
« Reply #16 on: March 18, 2006, 04:33:02 PM »
Thank you Alex,

I like the way you write the code... is no way that I can match that  :-( [please wait some few years, and you'll see]....  :lol:

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #17 on: March 18, 2006, 04:36:37 PM »
Thank you Alex,
I like the way you write the code... is no way that I can match that  :-( [please wait some few years, and you'll see]....  :lol:
Ok!  :lol:

LE

  • Guest
Re: INSIDEPT - Question
« Reply #18 on: March 18, 2006, 04:52:18 PM »
Alex;

Did you wrote is_curve_in_curve on the fly? or it was part of your library functions?



Thanks.

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #19 on: March 18, 2006, 05:08:57 PM »
Did you wrote is_curve_in_curve on the fly? or it was part of your library functions?
No I did not write such function on the fly. This function I was writing for Евгений Елпанов and now this function is a part of library. I only translate comment from Russion for you and other forum members. :) I think this library will be a part of next book of Nikolay Poleshchuk:  http://www.private.peterlink.ru/poleshchuk/cad/eng.html
« Last Edit: March 18, 2006, 05:13:19 PM by Rivilis »

LE

  • Guest
Re: INSIDEPT - Question
« Reply #20 on: March 18, 2006, 05:19:24 PM »
The reason I asked is because you mention "not very difficult"... and once I saw your code, man it does not look easy...  :-)

What do you think of the function I did?...

So, Евгений Елпанов does not write in ARX?....

I wonder if that book is going to be available in English... ? [it will be all about ObjectARX no?]


Thanks!

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1540
  • Moscow (Russia)
Re: INSIDEPT - Question
« Reply #21 on: March 18, 2006, 05:30:27 PM »
So, Евгений Елпанов does not write in ARX?....
No, I use only Lisp...  :-)
蝸牛そろそろ登れ富士の山 /Kobayashi Issa/

LE

  • Guest
Re: INSIDEPT - Question
« Reply #22 on: March 18, 2006, 05:38:54 PM »
No, I use only Lisp...  :-)

Thanks, so you work for МАЭСТРО too?

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1540
  • Moscow (Russia)
Re: INSIDEPT - Question
« Reply #23 on: March 18, 2006, 05:47:46 PM »
Thanks, so you work for МАЭСТРО too?
Again is no.
I work in firm "Kovcheg-parquet"
http://www.rusparquet.com/
My problem - development CAD...
蝸牛そろそろ登れ富士の山 /Kobayashi Issa/

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: INSIDEPT - Question
« Reply #24 on: March 19, 2006, 04:39:10 AM »
The reason I asked is because you mention "not very difficult"... and once I saw your code, man it does not look easy...  :-)
What do you think of the function I did?...
Yours function is well, but do not reflect some variants (contour's touching, contour 1 inside contour 2, etc.)

I wonder if that book is going to be available in English... ? [it will be all about ObjectARX no?]
I do not know about english translation of this book... :( I will ask Poleschuk about that.
This book not only about ObjectARX, and its 200 pages of ObjectARX is for novice (http://www.private.peterlink.ru/poleshchuk/cad/book15-05e.htm), but some of examples on CD is more complicated as far as is_curve_in_curve, dyndraw, etc. Maybe next edition of this book will has more pages about ObjectARX and .NET.

P.S. Евгений Елпанов is my friend from Moscow, and I sometimes make arx for him. Exactly he has brought me on this forum. :)
« Last Edit: March 19, 2006, 05:03:59 AM by Rivilis »

LE

  • Guest
Re: INSIDEPT - Question
« Reply #25 on: March 19, 2006, 01:24:51 PM »
Thank you Alex;

I am keeping the URL link for future reference.


And welcome again...