本文整理汇总了C++中AcGeMatrix3d::setToTranslation方法的典型用法代码示例。如果您正苦于以下问题:C++ AcGeMatrix3d::setToTranslation方法的具体用法?C++ AcGeMatrix3d::setToTranslation怎么用?C++ AcGeMatrix3d::setToTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcGeMatrix3d
的用法示例。
在下文中一共展示了AcGeMatrix3d::setToTranslation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: oldCenter
Acad::ErrorStatus
AsdkSmiley::transformBy(const AcGeMatrix3d& xform)
{
assertWriteEnabled();
// Transform the center point and get the translation vector
AcGePoint3d oldCenter( center() ),
newCenter( center() );
newCenter.transformBy( xform );
AcGeVector3d transVec = newCenter - center();
// Get the equivalent transformation
AcGeMatrix3d newXform;
newXform.setToTranslation( transVec );
// Only translate the face and mouth - do not transform!
mfacecircle.transformBy( newXform );
mmoutharc.transformBy( newXform );
// Get the point at a quadrant, transform it..
AcGePoint3d oldXquad = center() + AcGeVector3d( radius(), 0, 0 ),
newXquad( oldXquad );
newXquad.transformBy( xform );
// ... then scale the Smiley accordingly
if ( Adesk::kFalse == xform.isEqualTo( AcGeMatrix3d::kIdentity ))
scaleRadius( radius() * newCenter.distanceTo( newXquad ) / oldCenter.distanceTo( oldXquad ));
return Acad::eOk;
}
示例2: addHandlesForDragging
bool SketchSolverCircArc::addHandlesForDragging(SketchVCSDraggingData& dragData)
{
if (dragData.IsDragSingleGeom())
{
VCSRigidBody* pBodyOnCir = vcsBodyPtOnCircle(m_pContext->consData());
dragData.addBodyToDrag(pBodyOnCir);
//// Fix circle body (center position), when there has only one or zero constraint on circumference
//if (!m_pContext->consData().hasRelatedConsWithCircleToMakeVariable(this, false))
// centerPointSolverGeometry()->vcsBody()->setGrounded(true);
// Move the point on circle to the dragging position
AcGeVector3d vecToDragStartPt = dragData.startPt() - ptOnCircle();
AcGeMatrix3d mat;
mat.setToTranslation(vecToDragStartPt);
VCSMMatrix3d vMat = GeConv::toVCSMMatrix3d(mat);
pBodyOnCir->setTransform(vMat);
}
else
{
dragData.addBodyToDrag(vcsBody());
if (dragData.isDragGeom(centerPointSolverGeometry()))
{
if (NULL != m_pVcsRigidBodyPtOnCircle)
dragData.addBodyToDrag(m_pVcsRigidBodyPtOnCircle);
}
}
return true;
}
示例3: Transform
void Transform(AcDbEntity* pEntry, int xoffset = 0, int yoffset = 0, int zoffset = 0)
{
AcGeVector3d vec(xoffset,yoffset,zoffset);
AcGeMatrix3d moveMatrix;
moveMatrix.setToTranslation(vec);
pEntry->transformBy(moveMatrix);
}
示例4: moveToBottom
void moveToBottom(AcDbEntity* pEntry)
{
AcGeVector3d vec(-8,10,0);
AcGeMatrix3d moveMatrix;
moveMatrix.setToTranslation(vec);
pEntry->transformBy(moveMatrix);
}
示例5:
MaterialJig::MaterialJig(
const AcGePoint3d& center,
const AcDbObjectId& materialId)
{
mpMaterialEnt = (AsdkMaterial*)AsdkMaterial::desc()->create();
mpMaterialEnt->setDatabaseDefaults();
mpMaterialEnt->setMaterialId(materialId);
AcGeMatrix3d translateMat;
translateMat.setToTranslation(center.asVector());
mpMaterialEnt->setTransform(translateMat);
}
示例6: CreatePipe
void CreatePipe( const AcGePoint3d& start, const AcGePoint3d& end, const double& radius)
{
acutPrintf(L"开始绘制管体\n");
//得到线段的长度
double length = start.distanceTo(end);
if( length < 0.1 )
return;
acutPrintf(L"得到管体高度%lf\n",length);
//绘制圆柱体
AcDb3dSolid* p3dPipe = CreateCylinder(radius,length);
if( p3dPipe == NULL )
return;
//得到线段与Z轴的垂直向量
AcGeVector3d line3dVector(end.x - start.x,end.y - start.y, end.z-start.z);
AcGeVector3d rotateVctor = line3dVector.crossProduct(AcGeVector3d::kZAxis);
//得到旋转的角度
double angle = -line3dVector.angleTo(AcGeVector3d::kZAxis);
acutPrintf(L"得到旋转角度%lf\n",angle);
//进行旋转
AcGeMatrix3d rotateMatrix = AcGeMatrix3d::rotation( angle, rotateVctor, AcGePoint3d::kOrigin);
p3dPipe->transformBy(rotateMatrix);
//得到线段的中心点
AcGePoint3d center(start.x + end.x, start.y + end.y, start.z + end.z);
center /= 2;
acutPrintf(L"得到中心点[%lf][%lf][%lf]\n",center.x,center.y,center.z);
//进行偏移
AcGeMatrix3d moveMatrix;
moveMatrix.setToTranslation(AcGeVector3d(center.x,center.y,center.z));
p3dPipe->transformBy(moveMatrix);
//加入到3D模型中
PostToModelSpace(p3dPipe);
#ifdef DEBUG
acutPrintf(L"插入中心线,用于矫正");
AcDbLine *pLine = new AcDbLine(start, end);
PostToModelSpace(pLine);
#endif
}