Тема: почему не пересекаются 2 луча?
Задано :PoiontStartnew[X],PoiontStartnew[Y],PoiontStartnew[Z],v1;PoiontEndnew[X],PoiontEndnew[Y],PoiontEndnew[Z],v2.
используются функции:
AcDbObjectId createRay(double x,double y,double z,AcGeVector3d vector)
{
AcGePoint3d startPt(x,y,z);
AcDbRay *pRay = new AcDbRay();
pRay->setBasePoint(startPt);
pRay->setUnitDir(vector);
AcDbObjectId Rayid;
AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
pBlockTable->close();
pBlockTableRecord->appendAcDbEntity(Rayid,pRay);
pBlockTableRecord->close();
pRay->close();
return Rayid ;
}
AcGePoint3dArray Get_intersection_point (AcDbObjectId id1,AcDbObjectId id2)
{
AcGePoint3d point;
AcGePoint3dArray points;
AcDbEntity* pent1 = NULL;
AcDbEntity* pent2 = NULL;
acdbOpenAcDbEntity(pent1,id1,AcDb::kForRead);
acdbOpenAcDbEntity(pent2,id2,AcDb::kForRead);
pent1 -> intersectWith( pent2,AcDb::kOnBothOperands,points);
pent1->close();
pent2->close();
return points;
}
void peresechenie()
{
AcDbObjectId idr1 = createRay(PoiontStartnew[X],PoiontStartnew[Y],PoiontStartnew[Z],v1);
AcDbObjectId idr2 = createRay(PoiontEndnew[X],PoiontEndnew[Y],PoiontEndnew[Z],v2);
AcGePoint3dArray mas = NULL;
mass = Get_intersection_point(idr1,idr2);
for (i=0;i<mas.length();i++)
{
acutPrintf(_T("\np1 x = %g p1 y = % g"),mas[X],mas[Y]);
}
}
лучи рисует, но массив не заполняет. Почему? ведь AcDbRay наследник AcDbEntity.