本文整理汇总了C++中AcGeMatrix3d类的典型用法代码示例。如果您正苦于以下问题:C++ AcGeMatrix3d类的具体用法?C++ AcGeMatrix3d怎么用?C++ AcGeMatrix3d使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AcGeMatrix3d类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
ArxDbgDbAdeskLogo::getReferenceAttachmentPoint(AcDbEntity* ent, AcGePoint3d& toPt)
{
AcDbCircle* circ;
AcDbArc* arc;
AcDbLine* line;
AcDbPoint* point;
AcDbBlockReference* blkRef;
if ((circ = AcDbCircle::cast(ent)) != NULL)
toPt = circ->center();
else if ((arc = AcDbArc::cast(ent)) != NULL)
toPt = arc->center();
else if ((line = AcDbLine::cast(ent)) != NULL)
toPt = line->startPoint();
else if ((point = AcDbPoint::cast(ent)) != NULL)
toPt = point->position();
else if ((blkRef = AcDbBlockReference::cast(ent)) != NULL)
toPt = blkRef->position();
else {
// can't get anything better so just rely on the ECS. If the
// raw AutoCAD entities would do this, we wouldn't need the above
// switch statement.
AcGeMatrix3d mat;
ent->getEcs(mat);
AcGeVector3d v1, v2, v3;
mat.getCoordSystem(toPt, v1, v2, v3);
}
}
示例2: 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;
}
示例3: assertWriteEnabled
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;
}
示例4: switch
Acad::ErrorStatus
AsdkBody::applyPartialUndo(AcDbDwgFiler* filer, AcRxClass* classObj)
{
if (AsdkBody::desc() != classObj)
return AcDbEntity::applyPartialUndo( filer, classObj );
Adesk::Int16 opCode;
filer->readItem( &opCode );
switch (opCode)
{
case 555: // It is a transformBy() operation
{
// filer->readBytes( &mat, sizeof AcGeMatrix3d );
AcGeMatrix3d mat;
AcGeVector3d x, y, z;
AcGePoint3d o;
filer->readItem( &o );
filer->readItem( &x );
filer->readItem( &y );
filer->readItem( &z );
mat.setCoordSystem( o, x, y, z );
mat.invert();
transformBy( mat );
}
break;
default:
break;
}
return Acad::eOk;
}
示例5: vcsBodyPtOnCircle
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;
}
示例6: assertReadEnabled
Acad::ErrorStatus PDSphere::subExplode(AcDbVoidPtrArray& entitySet) const
#else
Acad::ErrorStatus PDSphere::explode(AcDbVoidPtrArray& entitySet) const
#endif
{
assertReadEnabled();
AcDb3dSolid *pBody;
pBody = new AcDb3dSolid;
if(pBody->createSphere(m_dRadius) != Acad::eOk)
{
delete pBody;
return Acad::eNotApplicable;
}
AcGeMatrix3d mat;
mat.setTranslation(m_ptCenter.asVector());
pBody->transformBy(mat);
pBody->setPropertiesFrom(this);
entitySet.append(pBody);
return Acad::eOk;
}
示例7: 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);
}
示例8: 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);
}
示例9: moveToBottom
void moveToBottom(AcDbEntity* pEntry)
{
AcGeVector3d vec(-8,10,0);
AcGeMatrix3d moveMatrix;
moveMatrix.setToTranslation(vec);
pEntry->transformBy(moveMatrix);
}
示例10: getEcsToWcsMatrix
void
ArxDbgUtils::getEcsPlane(const AcGeVector3d& entNormal, AcGePlane& ecsPlane)
{
AcGeMatrix3d ecsMat;
getEcsToWcsMatrix(AcGePoint3d::kOrigin, entNormal, ecsMat);
AcGePoint3d origin;
AcGeVector3d xAxis, yAxis, zAxis;
ecsMat.getCoordSystem(origin, xAxis, yAxis, zAxis);
ecsPlane.set(origin, xAxis, yAxis);
}
示例11:
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);
}
示例12: subTransformBy
Acad::ErrorStatus
ArxDbgDbAdeskLogo::subTransformBy(const AcGeMatrix3d& xform)
{
assertWriteEnabled();
// handle scale part of matrix here and
// let base class handle the rest.
if (xform.isScaledOrtho() && (xform.scale() != 1.0))
setScale(xform.scale());
return ArxDbgDbEntity::subTransformBy(xform);
}
示例13: 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
}
示例14: acutPrintf
void Additional_Class::RotateEnt( AcDbObjectId EntID, double RotateAng, AcGePoint3d InpPt)
{
AcDbEntity *pEnt_Temp;
if (acdbOpenAcDbEntity(pEnt_Temp, EntID, AcDb::kForWrite) != Acad::eOk)
{
acutPrintf(_T("\nOPEN ERROR"));
return;
}
AcGeMatrix3d tt;
AcGeVector3d zAxis;
zAxis.set(0,0,1);
tt.setToRotation(RotateAng, zAxis, InpPt);
pEnt_Temp->transformBy(tt);
pEnt_Temp->close();
}
示例15: assertWriteEnabled
Acad::ErrorStatus
AsdkBody::subTransformBy(const AcGeMatrix3d& xform)
{
AcDbDwgFiler *filer;
assertWriteEnabled( Adesk::kFalse );
if (NULL != (filer = undoFiler()))
{
filer->writeAddress(AsdkBody::desc() );
filer->writeItem( (Adesk::Int16)555 );
//filer->writeBytes( &xform, sizeof AcGeMatrix3d );
AcGePoint3d o;
AcGeVector3d x, y, z;
xform.getCoordSystem( o, x, y, z );
filer->writeItem( o );
filer->writeItem( x );
filer->writeItem( y );
filer->writeItem( z );
}
m_3dGeom.transform( *(Transf3d*)&xform );
return Acad::eOk;
}