当前位置: 首页>>代码示例>>C++>>正文


C++ AcGeVector3d::crossProduct方法代码示例

本文整理汇总了C++中AcGeVector3d::crossProduct方法的典型用法代码示例。如果您正苦于以下问题:C++ AcGeVector3d::crossProduct方法的具体用法?C++ AcGeVector3d::crossProduct怎么用?C++ AcGeVector3d::crossProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AcGeVector3d的用法示例。


在下文中一共展示了AcGeVector3d::crossProduct方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ASSERT

Acad::ErrorStatus
ArxDbgDbEntity::setNormal(const AcGeVector3d& nvec)
{
    if (nvec.isZeroLength()) {
        ASSERT(0);
        return Acad::eInvalidInput;
    }

    if (nvec != m_zDir) {
        assertWriteEnabled();

        AcGeVector3d txdir, tydir;
        AcGeVector3d txdiro, tydiro;

        ArxDbgUtils::getEcsXAxis(nvec, txdir);       // get AutoCAD's arbitrary X-Axis for this normal
        ArxDbgUtils::getEcsXAxis(m_zDir, txdiro);    // get AutoCAD's arbitrary X-Axis for this normal

        tydir = nvec.crossProduct(txdir);
        tydir.normalize();

        tydiro = m_zDir.crossProduct(txdiro);
        tydiro.normalize();

        AcGeMatrix3d mat;
        mat.setToAlignCoordSys(m_origin, txdiro, tydiro, m_zDir,
                               m_origin, txdir,  tydir,  nvec);

        m_xDir.transformBy(mat);
        m_zDir.transformBy(mat);
        m_origin.transformBy(mat);
    }

    return Acad::eOk;
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:34,代码来源:ArxDbgDbEntity.cpp

示例2: ASSERT

void
ArxDbgUtils::getEcsToWcsMatrix(const AcGePoint3d& origin,
                    const AcGeVector3d& zAxis, AcGeMatrix3d& mat)
{
    const double kArbBound = 0.015625;         //  1/64th

        // short circuit if in WCS already
    if (zAxis == AcGeVector3d::kZAxis) {
        mat.setToIdentity();
        return;
    }

    AcGeVector3d xAxis, yAxis;

    ASSERT(zAxis.isUnitLength());

    if ((fabs(zAxis.x) < kArbBound) && (fabs(zAxis.y) < kArbBound))
        xAxis = AcGeVector3d::kYAxis.crossProduct(zAxis);
    else
        xAxis = AcGeVector3d::kZAxis.crossProduct(zAxis);

    xAxis.normalize();
    yAxis = zAxis.crossProduct(xAxis);
    yAxis.normalize();

    mat.setCoordSystem(AcGePoint3d::kOrigin, xAxis, yAxis, zAxis);
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:27,代码来源:ArxDbgUtilsDb.cpp

示例3: jig

void
createSmiley()
{
    AcGePoint3d cen;
    struct resbuf rbFrom, rbTo;

    ads_getpoint( NULL, "\nCenter point: ", asDblArray( cen ));

    rbFrom.restype = RTSHORT;
    rbFrom.resval.rint = 1; // from UCS
    rbTo.restype = RTSHORT;
    rbTo.resval.rint = 0; // to WCS

    ads_trans( asDblArray( cen ), &rbFrom, &rbTo, Adesk::kFalse, asDblArray( cen ));

    AcGeVector3d x = acdbHostApplicationServices()->workingDatabase()->ucsxdir();
    AcGeVector3d y = acdbHostApplicationServices()->workingDatabase()->ucsydir();

    AcGeVector3d normalVec = x.crossProduct( y );
    normalVec.normalize();

    SmileyJig jig( cen, normalVec );

    jig.start();
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:25,代码来源:SmileJig.cpp

示例4: getFaceVect

AcGeVector3d PDEcone::getFaceVect() const
{
    assertReadEnabled();
    AcGeVector3d centerVect = m_ptEnd - m_ptStart;
	AcGeVector3d tmpV1 = centerVect.crossProduct(m_vect);
	return m_vect.crossProduct(tmpV1).normal();
}
开发者ID:wangfeilong321,项目名称:PDMS_ExportModel,代码行数:7,代码来源:PDEcone.cpp

示例5: getEndPtOrthoInStartPtPlane

AcGePoint3d PDEcone::getEndPtOrthoInStartPtPlane()const
{
	assertReadEnabled();

	AcGeVector3d centerVect = m_ptEnd - m_ptStart;
	AcGeVector3d tmpV = centerVect.crossProduct(m_vect);
	tmpV = m_vect.crossProduct(tmpV);
	return m_ptEnd.orthoProject(AcGePlane(m_ptStart, tmpV));
}
开发者ID:wangfeilong321,项目名称:PDMS_ExportModel,代码行数:9,代码来源:PDEcone.cpp

示例6: getEndPointInExtendAngle

AcGeVector3d DoubleArcTunnelDraw::getEndPointInExtendAngle() const
{
    AcGeCircArc3d arc( m_startPt, m_thirdPt, m_endPt );
    AcGePoint3d cenPt = arc.center();
    AcGeVector3d v = m_endPt - cenPt;
    AcGeVector3d v2 = m_startPt - m_endPt;
    AcGeVector3d v3 = v.crossProduct( v2 );
    int c = ( v3.z > 0 ? 1 : -1 );
    v.rotateBy( c * PI / 2, AcGeVector3d::kZAxis );
    return v;
}
开发者ID:kanbang,项目名称:TIDS,代码行数:11,代码来源:SingleArcTunnelDraw.cpp

示例7: acedGetPoint

// This function uses the AcEdJig mechanism to create and
// drag an ellipse entity.  The creation criteria are
// slightly different from the AutoCAD command.  In this
// case, the user selects an ellipse center point and then,
// drags to visually select the major and minor axes
// lengths.  This sample is somewhat limited; if the
// minor axis ends up longer than the major axis, then the
// ellipse will just be round because the radius ratio
// cannot be greater than 1.0.
//
void
createEllipse()
{
    // First, have the user select the ellipse center point.
    // We don't use the jig for this because there is
    // nothing to see yet.
    //
    AcGePoint3d tempPt;
    struct resbuf rbFrom, rbTo;

    acedGetPoint(NULL, _T("\nEllipse center point: "),
        asDblArray(tempPt));

    // The point we just got is in UCS coordinates, but
    // AcDbEllipse works in WCS, so convert the point.
    //
    rbFrom.restype = RTSHORT;
    rbFrom.resval.rint = 1; // from UCS
    rbTo.restype = RTSHORT;
    rbTo.resval.rint = 0; // to WCS

    acedTrans(asDblArray(tempPt), &rbFrom, &rbTo,
        Adesk::kFalse, asDblArray(tempPt));

    // Now you need to get the current UCS z-Axis to be used
    // as the normal vector for the ellipse.
    //
    AcGeVector3d x = acdbHostApplicationServices()->workingDatabase()
                     ->ucsxdir();
    AcGeVector3d y = acdbHostApplicationServices()->workingDatabase()
                     ->ucsydir();
    AcGeVector3d normalVec = x.crossProduct(y);
    normalVec.normalize();

    // Create an AsdkEllipseJig object passing in the
    // center point just selected by the user and the normal
    // vector just calculated.
    //
    AsdkEllipseJig *pJig
        = new AsdkEllipseJig(tempPt, normalVec);

    // Now start up the jig to interactively get the major
    // and minor axes lengths.
    //
    pJig->doIt();

    // Now delete the jig object, since it is no longer needed.
    //
    delete pJig;
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:60,代码来源:elipsjig.cpp

示例8: extendByLength

void DoubleArcTunnelDraw::extendByLength( double length )
{
    AcGeCircArc3d arc( m_startPt, m_thirdPt, m_endPt );
    AcGePoint3d cenPt = arc.center();
    double radius = arc.radius();
    AcGeVector3d v = m_endPt - cenPt;
    AcGeVector3d v2 = m_startPt - m_endPt;
    AcGeVector3d v3 = v.crossProduct( v2 );
    int c = ( v3.z > 0 ? 1 : -1 );

    v.rotateBy( c * length / radius, AcGeVector3d::kZAxis );

    m_endPt = cenPt + v; // 修改圆弧的末点
}
开发者ID:kanbang,项目名称:TIDS,代码行数:14,代码来源:SingleArcTunnelDraw.cpp

示例9: switch

AcGeVector3d  
AcRectangle::setDimValueCbackFunc(AcDbDimData* pThis, 
                                  AcDbEntity* pEnt, 
                                  double value,
								  const AcGeVector3d& offset)
{
    if ((pThis == NULL) || (pEnt == NULL))
        return offset;
	
    pEnt->assertWriteEnabled();

    AppData *pDimAppData = (AppData*)pThis->appData();
    if (pDimAppData == NULL)
        return offset;

    int dimId = pDimAppData->index();
    if ((dimId < 1) || (dimId > 10))
        return offset;

    AcRectangle *pRect = AcRectangle::cast(pEnt);
    if (pRect == NULL)
        return offset;

    AcGePoint3d pt1, pt2, pt3, pt4, dimPt;
    AcGeVector3d diaVec;
    AcGeVector3d mHorizDir = pRect->horizDir();
    AcGeVector3d mNormal = pRect->normal();
    AcGeVector3d vertDir = mNormal.crossProduct(mHorizDir);
    AcGePoint3d mCenter = pRect->center();
    double mWidth = pRect->width();
    double mHeight = pRect->height();
    pt1 = mCenter + 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
    pt2 = mCenter - 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
    pt3 = mCenter - 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
    pt4 = mCenter + 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;

    switch (dimId) {
    case 1:
        mCenter = mCenter + value * mHorizDir;
        pRect->setCenter(mCenter);
        break;

    case 2:
        mCenter = mCenter + value * vertDir;
        pRect->setCenter(mCenter);
        break;
        
    case 3:
        pt1 = pt2 + value * mHorizDir;
        diaVec = pt1 - pt3;
        mCenter = pt3 + 0.5 * diaVec;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        pRect->setCenter(mCenter);
        pRect->setWidth(mWidth);
        pRect->setHeight(mHeight);
        break;

    case 4:
        pt1 = pt4 + value * vertDir;
        diaVec = pt1 - pt3;
        mCenter = pt3 + 0.5 * diaVec;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        pRect->setCenter(mCenter);
        pRect->setWidth(mWidth);
        pRect->setHeight(mHeight);
        break;

    case 5:
        pt2 = pt1 - value * mHorizDir;
        diaVec = pt2 - pt4;
        mCenter = pt4 + 0.5 * diaVec;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        pRect->setCenter(mCenter);
        pRect->setWidth(mWidth);
        pRect->setHeight(mHeight);
        break;

    case 6:
        pt2 = pt3 + value * vertDir;
        diaVec = pt2 - pt4;
        mCenter = pt4 + 0.5 * diaVec;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        pRect->setCenter(mCenter);
        pRect->setWidth(mWidth);
        pRect->setHeight(mHeight);
        break;

    case 7:
        pt3 = pt2 - value * vertDir;
        diaVec = pt3 - pt1;
        mCenter = pt1 + 0.5 * diaVec;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        pRect->setCenter(mCenter);
        pRect->setWidth(mWidth);
        pRect->setHeight(mHeight);
//.........这里部分代码省略.........
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:101,代码来源:acrect.cpp

示例10: userToLocalAngle

void
AcRectangle::gripDimensionCbackFuncGuts(AcDbGripData* pGrip, 
                                        const AcDbObjectId& objId,
                                        double dimScale,
                                        AcDbDimDataPtrArray& dimDataArr,
                                        bool isHover)
{
    if (pGrip == NULL)
        return;

    AppData *pAppData = (AppData*)pGrip->appData();
    int gripID = pAppData ? pAppData->index() : -1;
    if ((gripID < 0) || (gripID > 4))
        return;

    AcDbEntity *pEnt = NULL;
	if (acdbOpenAcDbEntity(pEnt, objId, AcDb::kForRead) != Acad::eOk)
        return;

    AcRectangle *pRect = AcRectangle::cast(pEnt);
    if (pRect == NULL) {
        pEnt->close();
        return;
    }

    AcGeVector3d mHorizDir = pRect->horizDir();
    AcGeVector3d mNormal = pRect->normal();
    AcGeVector3d vertDir = mNormal.crossProduct(mHorizDir);
    AcGePoint3d mCenter = pRect->center();
    double mWidth = pRect->width();
    double mHeight = pRect->height();
    double mElevation = pRect->elevation();
    pRect->close();

    int dimIndex1 = 0, dimIndex2 = 0;
    AcGePoint3d pt1, pt2, pt3, pt4, dimPt1, dimPt2;
    double horizRot = userToLocalAngle(mNormal, mHorizDir);
    pt1 = mCenter + 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
    pt2 = mCenter - 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
    pt3 = mCenter - 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
    pt4 = mCenter + 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;

    AcDbAlignedDimension *pAlnDim1 = new AcDbAlignedDimension();
    pAlnDim1->setDatabaseDefaults();
    pAlnDim1->setNormal(mNormal);
    pAlnDim1->setElevation(mElevation);
    //pAlnDim1->setDimtad(1);
    pAlnDim1->setHorizontalRotation(-horizRot);

    AcDbAlignedDimension *pAlnDim2 = new AcDbAlignedDimension();
    pAlnDim2->setDatabaseDefaults();
    pAlnDim2->setNormal(mNormal);
    pAlnDim2->setElevation(mElevation);
    //pAlnDim2->setDimtad(1);
    pAlnDim2->setHorizontalRotation(-horizRot);

    if (isHover) {
        AcCmColor dimColor;
        dimColor.setColorIndex(8);  // gray    
        pAlnDim1->setDimclrd(dimColor);
        pAlnDim1->setDimclre(dimColor);
        pAlnDim1->setDimclrt(dimColor);
        pAlnDim2->setDimclrd(dimColor);
        pAlnDim2->setDimclre(dimColor);
        pAlnDim2->setDimclrt(dimColor);
	}

    switch (gripID) {
    case 1:
        dimIndex1 = 3;
        dimPt1 = mCenter + (0.5 * mHeight + 0.5 * dimScale) * vertDir;
        pAlnDim1->setXLine1Point(pt1);
        pAlnDim1->setXLine2Point(pt2);
        pAlnDim1->setDimLinePoint(dimPt1);

        dimIndex2 = 4;  
        dimPt2 = mCenter + (0.5 * mWidth + 0.5 * dimScale) * mHorizDir;
        pAlnDim2->setXLine1Point(pt1);
        pAlnDim2->setXLine2Point(pt4);
        pAlnDim2->setDimLinePoint(dimPt2);
        break;

    case 2:
        dimIndex1 = 5;
        dimPt1 = mCenter + (0.5 * mHeight + 0.5 * dimScale) * vertDir;
        pAlnDim1->setXLine1Point(pt1);
        pAlnDim1->setXLine2Point(pt2);
        pAlnDim1->setDimLinePoint(dimPt1);

        dimIndex2 = 6;
        dimPt2 = mCenter - (0.5 * mWidth + 0.5 * dimScale) * mHorizDir;
        pAlnDim2->setXLine1Point(pt2);
        pAlnDim2->setXLine2Point(pt3);
        pAlnDim2->setDimLinePoint(dimPt2);
        break;

    case 3:
        dimIndex1 = 7;
        dimPt1 = mCenter - (0.5 * mWidth + 0.5 * dimScale) * mHorizDir;
        pAlnDim1->setXLine1Point(pt2);
//.........这里部分代码省略.........
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:101,代码来源:acrect.cpp

示例11: acutPrintf


//.........这里部分代码省略.........
	
	case(kNurbSurface):
    {
		acutPrintf(ACRX_T("\nSurface Type: NURB Surface\n"));
        AcGeNurbSurface* nurbGeometry = (AcGeNurbSurface*)nativeGeometry;
		int nCtrlPtsU = nurbGeometry->numControlPointsInU();
		int nCtrlPtsV = nurbGeometry->numControlPointsInV();
		int nKnotsU = nurbGeometry->numKnotsInU();
		int nKnotsV = nurbGeometry->numKnotsInV();
		acutPrintf(ACRX_T("\nSurface Definition Data Begin:\n"));
		acutPrintf(ACRX_T(" NURB Surface degree in U is %d\n"), nurbGeometry->degreeInU());
		acutPrintf(ACRX_T(" NURB Surface degree in V is %d\n"), nurbGeometry->degreeInV());
		acutPrintf(ACRX_T(" NURB Surface number of control points in U is %d\n"), nCtrlPtsU);
		acutPrintf(ACRX_T(" NURB Surface number of control points in V is %d\n"), nCtrlPtsV);
		acutPrintf(ACRX_T(" NURB Surface number of knots in U is %d\n"), nKnotsU);
		acutPrintf(ACRX_T(" NURB Surface number of knots in V is %d\n"), nKnotsV);
		acutPrintf(ACRX_T("Surface Definition Data End\n"));
		break;
    }
	
	// NOTE: This surface is not yet supported in AcGe, so we infer the definition
	// data by analysing evaluated data on the external bounded surface.
	case(kEllipCylinder):
	{
		acutPrintf(ACRX_T("\nSurface Type: Elliptic Cylinder\n"));
        AcGePoint3d p0 = surfaceGeometry->evalPoint(AcGePoint2d(0.0, 0.0));
        AcGePoint3d p1 = surfaceGeometry->evalPoint(AcGePoint2d(0.0, kPi));
        AcGePoint3d p2 = surfaceGeometry->evalPoint(AcGePoint2d(0.0, kHalfPi));
        AcGePoint3d origin(((p0.x + p1.x) / 2.0),
			               ((p0.y + p1.y) / 2.0),
						   ((p0.z + p1.z) / 2.0));
        AcGeVector3d majAxis = p0 - origin;
        AcGeVector3d minAxis = p2 - origin;
        AcGeVector3d symAxis = (majAxis.crossProduct(minAxis)).normalize();
		acutPrintf(ACRX_T("\nSurface Definition Data Begin:\n"));
		acutPrintf(ACRX_T(" Elliptic Cylinder origin is ("));
		acutPrintf (ACRX_T("%lf , "), origin.x);	
		acutPrintf (ACRX_T("%lf , "), origin.y);
		acutPrintf (ACRX_T("%lf "), origin.z);
		acutPrintf(ACRX_T(")\n"));	
		acutPrintf(ACRX_T(" Elliptic Cylinder major radius is %lf\n"), majAxis.length());
		acutPrintf(ACRX_T(" Elliptic Cylinder minor radius is %lf\n"), minAxis.length());
		acutPrintf(ACRX_T(" Elliptic Cylinder major axis is ("));
		acutPrintf (ACRX_T("%lf , "), majAxis.x);	
		acutPrintf (ACRX_T("%lf , "), majAxis.y);
		acutPrintf (ACRX_T("%lf "), majAxis.z);
		acutPrintf(ACRX_T(")\n"));	
		acutPrintf(ACRX_T(" Elliptic Cylinder minor axis is ("));
		acutPrintf (ACRX_T("%lf , "), minAxis.x);	
		acutPrintf (ACRX_T("%lf , "), minAxis.y);
		acutPrintf (ACRX_T("%lf "), minAxis.z);
		acutPrintf(ACRX_T(")\n"));	
		acutPrintf(ACRX_T(" Elliptic Cylinder axis of symmetry is ("));
		acutPrintf (ACRX_T("%lf , "), symAxis.x);	
		acutPrintf (ACRX_T("%lf , "), symAxis.y);
		acutPrintf (ACRX_T("%lf "), symAxis.z);
		acutPrintf(ACRX_T(")\n"));	
		acutPrintf(ACRX_T("Surface Definition Data End\n"));
		break;
	}

	// NOTE: This surface is not yet supported in AcGe, so we infer the definition
	// data by analysing evaluated data on the external bounded surface.
	case(kEllipCone):
	{
		acutPrintf(ACRX_T("\nSurface Type: Elliptic Cone\n"));
开发者ID:Bohr27,项目名称:ObjectARXCore,代码行数:67,代码来源:brfdump.cpp

示例12: pos

Adesk::Boolean
AsdkTextStyleSamp::worldDraw(AcGiWorldDraw* pW)
{
    AcGePoint3d pos(4.0, 4.0, 0.0);
    AcGeVector3d norm(0.0, 0.0, 1.0);
    AcGeVector3d dir(-1.0, -0.2, 0.0);
    char *pStr = "This is a percent, '%%%'.";
    int len = strlen(pStr);
    AcGiTextStyle style;

    AcGeVector3d vec = norm;
    vec = vec.crossProduct(dir);
    dir = vec.crossProduct(norm);

    style.setFileName("txt.shx");
    style.setBigFontFileName("");
    int status;
    if (!((status = style.loadStyleRec()) & 1))
        pStr = "Font not found.";

    pW->geometry().text(pos, norm, dir, pStr, len,
        Adesk::kFalse, style);

    pos.y += 2.0;

    style.setTrackingPercent(0.8); 
	style.setObliquingAngle(0.5);

    AcGePoint2d ext = style.extents(pStr, Adesk::kFalse,
        strlen(pStr), Adesk::kFalse);

    pW->geometry().text(pos, norm, dir, pStr, len,
        Adesk::kFalse, style);

    // Draw a rectangle around the last text drawn.
    // First you have to create a polyline the size of the
    // bounding box, then you have to transform it to the
    // correct orientation, and then to the location of the
    // text.
    
    // Compute the matrix that orients the box.
    //
    AcGeMatrix3d textMat;
    norm.normalize();
    dir.normalize();
    AcGeVector3d yAxis = norm;
    yAxis = yAxis.crossProduct(dir);
    yAxis.normalize();
    textMat.setCoordSystem(AcGePoint3d(0.0, 0.0, 0.0), dir,
        yAxis, norm);

    // Create the bounding box and enlarge it somewhat.
    //
    double offset = ext.y / 2.0;
    AcGePoint3d verts[5];
    verts[0] = verts[4] = AcGePoint3d(-offset, -offset, 0.0);
    verts[1] = AcGePoint3d(ext.x + offset, -offset, 0.0);
    verts[2] = AcGePoint3d(ext.x + offset, ext.y + offset, 0.0);
    verts[3] = AcGePoint3d(-offset, ext.y + offset, 0.0);

    // Orient and then translate each point in the
    // bounding box.
    //
    for (int i = 0; i < 5; i++) {
        verts[i].transformBy(textMat);
        verts[i].x += pos.x;
        verts[i].y += pos.y;
        verts[i].z += pos.z;
    }
    pW->geometry().polyline(5, verts);

    return Adesk::kTrue;
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:73,代码来源:textstyl.cpp

示例13: es

void
AcCircle::gripDimensionCbackfn(				AcDbGripData* pThis,
											const AcDbObjectId& entId,
											double dimScale,
											AcDbDimDataPtrArray& dimData)
{
		std::string *pszAppData  = static_cast<std::string *>(pThis->appData());

		
		AcDbEntity *pEnt = NULL;
		Acad::ErrorStatus es(Acad::eNotImplementedYet);

		if( Acad::eOk != acdbOpenAcDbEntity(pEnt,entId,AcDb::kForRead) ){
			acutPrintf("\n Error in returning valid pointer to an Entity");
			return;
		}
		
		AcCircle   *pCircle = static_cast<AcCircle *>(pEnt);
		mentId = entId;
		
		AcGeVector3d mNormal = pCircle->normal();

		AcGeVector3d NormalDir    = pCircle->normal();
		
		AcGeVector3d horizDir =		mNormal.perpVector();
		AcGeVector3d vertDir =		mNormal.crossProduct(horizDir);
		
		AcGePoint3d  center	  = pCircle->Center();
		double		 radius	      = pCircle->radius();
        int          dimIndex1(0);




		AcGePoint3d points[5] =
		{
			center,
			center + radius * horizDir,
			center + radius * vertDir,
			center - radius * horizDir,
			center - radius * vertDir
		};

		AcGePoint3d dimPt1,dimPt2;


	    AcDb2LineAngularDimension *pDim1 = new  AcDb2LineAngularDimension ();
		pDim1->setDatabaseDefaults();

		pDim1->setNormal(NormalDir);


		if( *pszAppData == "First")
		{
		      dimIndex1 =1;
		      dimPt1 = center + (1.5 * radius + 0.5 * dimScale) * horizDir;

		      pDim1->setXLine1Start(points[0]);
	      	  pDim1->setXLine1End(points[1]);
		      pDim1->setXLine2Start(points[0]);
		      pDim1->setXLine2End(points[2]);
		      pDim1->setArcPoint(dimPt1);
		}
		else if( *pszAppData == "Second")
		{
            dimIndex1=2;
			dimPt1 =  center + (1.5* radius + 0.5 * dimScale) * vertDir;
			pDim1->setXLine1Start(points[0]);
			pDim1->setXLine1End(points[2]);

			pDim1->setXLine2Start(center);
			pDim1->setXLine2End(points[3]);
			pDim1->setArcPoint(dimPt1);

		}
		else if(*pszAppData == "Third")
		{
			dimIndex1=3;
			dimPt1 =  center -  (1.5*radius + 0.5 * dimScale) * horizDir;
			pDim1->setXLine1Start(points[0]);
			pDim1->setXLine1End(points[3]);

			pDim1->setXLine2Start(points[0]);
			pDim1->setXLine2End(points[4]);
			pDim1->setArcPoint(dimPt1);
		}
		else if( *pszAppData == "Fourth")

		{
			dimIndex1=4;
			dimPt1 =  center - (1.5 * radius + 0.5 * dimScale) * vertDir;
			pDim1->setXLine1Start(points[0]);
			pDim1->setXLine1End(points[4]);

			pDim1->setXLine2Start(points[0]);
			pDim1->setXLine2End(points[1]);
			pDim1->setArcPoint(dimPt1);
		}

		unsigned int bitFlags(0);
//.........这里部分代码省略.........
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:101,代码来源:AcCircle.cpp


注:本文中的AcGeVector3d::crossProduct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。