ObjectARX, AutoCAD. Среда программирования библиотеки C++


         

infinite line and find


if ((es = getVertices3d(vertexArray)) != Acad::eOk) {

return es;

}

AcGeLineSeg3d lnsg(vertexArray[startIndex],

vertexArray[startIndex + 1]);

AcGePoint3d pt;

AcGeLine3d line, perpLine;

AcGeVector3d vec;

AcGeVector3d viewDir(viewXform(Z, 0), viewXform(Z, 1),

viewXform(Z, 2));

switch (osnapMode) {

case AcDb::kOsModeEnd:

snapPoints.append(vertexArray[startIndex]);

snapPoints.append(vertexArray[startIndex + 1]);

break;

case AcDb::kOsModeMid:

pt.set(

((vertexArray[startIndex])[X]

+ (vertexArray[startIndex + 1])[X]) * 0.5,

((vertexArray[startIndex])[Y]

+ (vertexArray[startIndex + 1])[Y]) * 0.5,

((vertexArray[startIndex])[Z]

+ (vertexArray[startIndex + 1])[Z]) * 0.5);

snapPoints.append(pt);

break;

case AcDb::kOsModeNear:

pt = lnsg.projClosestPointTo(pickPoint, viewDir);

snapPoints.append(pt);

break;

case AcDb::kOsModePerp:

// Create a semi- infinite line and find a point on it.

//

vec = vertexArray[startIndex + 1]

- vertexArray[startIndex];

vec.normalize();

line.set(vertexArray[startIndex], vec);

pt = line.closestPointTo(lastPoint);

snapPoints.append(pt);

break;

case AcDb::kOsModeCen:

snapPoints.append(center);

break;

default:

return Acad::eOk;

}

return es;

}


Содержание  Назад  Вперед