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


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

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


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

示例1: update

Adesk::Boolean TunnelDragJig::update()
{
    AcGePlane plane;
    AcGeVector3d v = ept - spt;
    v.normalize();

    v.rotateBy( 0.5 * PI, AcGeVector3d::kZAxis );

    AcGeVector3d offset = curPt - basePt;
    double L = offset.dotProduct( v );
    if( L == 0 ) return false;

    if( L < 0 )
    {
        v.negate();
        L = -1 * L;
    }

    AcGePoint3d newSpt = spt + v * L, newEpt = ept + v * L;

    // 更新工作面坐标
    m_pWS->setSEPoint( newSpt, newEpt );
    m_pWS->updateDraw();

    return Adesk::kTrue;
}
开发者ID:kanbang,项目名称:myexercise,代码行数:26,代码来源:TunnelDragJig.cpp

示例2: update

// This function is called to update the entity based on the
// input values
//
Adesk::Boolean AcRectJig::update()
{
    AcGeVector3d diaVec = mWcsPt2 - mWcsPt1;
    AcGePoint3d cenPt = mWcsPt1 + 0.5 * diaVec;
    double width = fabs(diaVec.dotProduct(mHorizDir));
    double height = fabs(diaVec.dotProduct(mVertDir));

    if (!(mLockWidth || mLockHeight))
        mpRect->setCenter(cenPt);

    if (!mLockWidth)
        mpRect->setWidth(width);

    if (!mLockHeight)
        mpRect->setHeight(height);

    updateDimData();

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

示例3: 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

示例4: assertWriteEnabled

Acad::ErrorStatus
AcRectangle::moveGripPointsAt(const AcDbVoidPtrArray& appData,
                              const AcGeVector3d& offset,
                              const int bitflags)
{
    assertWriteEnabled();
	if (!appData.length())
		return Acad::eInvalidInput;

    AcGePoint3d pt1, pt2;
    AcGeVector3d diaVec;

    AppData *pAppData = (AppData*)appData[0];
    int gripID = pAppData->index();
    AcGeVector3d vertDir = mNormal.crossProduct(mHorizDir);
	
    switch(gripID) {
    case 0:
        mCenter += offset;
        break;

    case 1:
        pt1 = mCenter + 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
        pt2 = mCenter - 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
        pt1 += offset;
        diaVec = pt1 - pt2;
        mCenter += 0.5 * offset;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        break;

    case 2:
        pt1 = mCenter - 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
        pt2 = mCenter + 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
        pt1 += offset;
        diaVec = pt1 - pt2;
        mCenter += 0.5 * offset;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        break;

    case 3:
        pt1 = mCenter - 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
        pt2 = mCenter + 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
        pt1 += offset;
        diaVec = pt1 - pt2;
        mCenter += 0.5 * offset;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        break;
	
    case 4:
        pt1 = mCenter + 0.5 * mWidth * mHorizDir - 0.5 * mHeight * vertDir;
        pt2 = mCenter - 0.5 * mWidth * mHorizDir + 0.5 * mHeight * vertDir;
        pt1 += offset;
        diaVec = pt1 - pt2;
        mCenter += 0.5 * offset;
        mWidth = fabs(diaVec.dotProduct(mHorizDir));
        mHeight = fabs(diaVec.dotProduct(vertDir));
        break;
	}

    // Update dynamic dimensions
    //
    AcDbDimDataPtrArray *pDimDataArr = NULL;
    if (pAppData)
        pDimDataArr = pAppData->dimData();

    updateDimensions(pDimDataArr);

    return Acad::eOk;

}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:73,代码来源:acrect.cpp

示例5: update

//-----------------------------------------------------------------------------
// This function is called to update the entity based on the
// input values
//
Adesk::Boolean AsdkRectangleJig::update()
{
    AcGePoint2d adjustedPoint;
    AcGePoint3d tmpPoint;       // Used by MAKEUCSCOORD macro.

    // We'll use the AcGeLine::intersectWith() function to infer the
    // remaining points.
    //
    AcGeLine3d lineX, lineY;
    lineX.set(m_TopLeftCorner, m_vecUnitX);
    lineY.set(m_BottomRightCorner, m_vecUnitY);
    // Top right corner is intersection of lineX and lineY.
    //
    lineX.intersectWith(lineY, m_TopRightCorner);

    lineX.set(m_BottomRightCorner, m_vecUnitX);
    lineY.set(m_TopLeftCorner, m_vecUnitY);
    // Bottom left corner is intersection of lineX and lineY.
    //
    lineX.intersectWith(lineY, m_BottomLeftCorner);

    AcGeVector3d tmpXVec, tmpYVec;
    // Check to see if we have flipped around the X or Y axis.
    //
    bool bXFlip = m_vecUnitX.dotProduct(m_TopLeftCorner - m_TopRightCorner)  >0;
    bool bYFlip = m_vecUnitY.dotProduct(m_TopLeftCorner - m_BottomLeftCorner)<0; 

    // If the rectangle is dragged into the first or third quadrant,
    // we need to reverse the sign of the bulge as well as reverse
    // the x and y direction vectors.
    //
    tmpXVec = bXFlip ? -1 * m_vecUnitX : m_vecUnitX;
    tmpYVec = bYFlip ? -1 * m_vecUnitY : m_vecUnitY;
   
    // Now update the polyline with the latest setting
    //
    if (plineInfo.m_cornerTreatment) {
        // We are going to fillet of chamfer this polyline rectangle. As such,
        // the constructor has added the extra points at the corners to allow
        // for there placement and bulge values to be updated on the fly.
        // If, during the dragging, the rectangle is still too small to show the
        // given radius or chamfer edges, the we will put the extra points in the 
        // corners and set the bulges to 0.0, so the rectangle retains its 
        // square corners until the user stretches the rectangle to a size large
        // enough to have the corner treatment displayed.
        //

        // Use temporaries to see if we're too small to show fillet/chamfer, so
        // we don't need to convert back to world.
        // 
        AcGePoint2d point_TL, point_TR, point_BL;
        MAKEUCSCOORD(point_TL, m_TopLeftCorner);
        MAKEUCSCOORD(point_TR, m_TopRightCorner);
        MAKEUCSCOORD(point_BL, m_BottomLeftCorner);

        bool tooSmall = (point_TL.distanceTo(point_TR)
            < plineInfo.m_first + plineInfo.m_second)
            || (point_TL.distanceTo(point_BL)
            < plineInfo.m_first + plineInfo.m_second);
        if (tooSmall) {
            // Still to small to show the corner treatment.
            //
            m_pLWPoly->setBulgeAt(0, 0.0);
            MAKEUCSCOORD(adjustedPoint, m_TopLeftCorner);
            m_pLWPoly->setPointAt(0, adjustedPoint);
            m_pLWPoly->setPointAt(1, adjustedPoint);

            m_pLWPoly->setBulgeAt(2, 0.0);  
            MAKEUCSCOORD(adjustedPoint, m_TopRightCorner);
            m_pLWPoly->setPointAt(2, adjustedPoint);
            m_pLWPoly->setPointAt(3, adjustedPoint);

            m_pLWPoly->setBulgeAt(4, 0.0);  
            MAKEUCSCOORD(adjustedPoint, m_BottomRightCorner);
            m_pLWPoly->setPointAt(4, adjustedPoint);
            m_pLWPoly->setPointAt(5, adjustedPoint);

            m_pLWPoly->setBulgeAt(6, 0.0);  
            MAKEUCSCOORD(adjustedPoint, m_BottomLeftCorner);
            m_pLWPoly->setPointAt(6, adjustedPoint);
            m_pLWPoly->setPointAt(7, adjustedPoint);
        } else {
            double tmpBulge;

            tmpBulge = ((!bXFlip && !bYFlip) || (bXFlip && bYFlip))
                ? plineInfo.m_bulge : -plineInfo.m_bulge;

            // Now we will set adjustedPoint to the intersection of the rectangle
            // sides with the place where the new end points will be.
            //
            m_pLWPoly->setBulgeAt(0, tmpBulge);
            MAKEUCSCOORD(adjustedPoint,
                m_TopLeftCorner + (-plineInfo.m_first * tmpYVec));
            m_pLWPoly->setPointAt(0, adjustedPoint);
                   
            MAKEUCSCOORD(adjustedPoint,
//.........这里部分代码省略.........
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:101,代码来源:rectangle.cpp


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