本文整理汇总了C++中AcGeVector3d::length方法的典型用法代码示例。如果您正苦于以下问题:C++ AcGeVector3d::length方法的具体用法?C++ AcGeVector3d::length怎么用?C++ AcGeVector3d::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcGeVector3d
的用法示例。
在下文中一共展示了AcGeVector3d::length方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheackTubeLenth
static bool CheackTubeLenth(AcDbObjectId& objId)
{
objId = ArxUtilHelper::SelectObject( _T( "请选择一条瓦斯管路:" ) );
if( objId.isNull() ) return false;
if( !ArxUtilHelper::IsEqualType( _T( "GasTube" ), objId ) ) return false;
AcTransaction *pTrans = actrTransactionManager->startTransaction();
if ( 0 == pTrans ) return false;
AcDbObject *pObj;
if (Acad::eOk != pTrans->getObject(pObj,objId,AcDb::kForRead)) return false;
GasTube *pGasTube = GasTube::cast(pObj);
if ( 0 == pGasTube)
{
actrTransactionManager->abortTransaction();
return false;
}
AcGePoint3d spt,ept;
pGasTube->getSEPoint(spt,ept);
//double angle = pGasTube->getAngle();
actrTransactionManager->endTransaction();
AcGeVector3d v = ept - spt;
double tubeLenth = v.length();
return true;
}
示例2: AddDirection
static void AddDirection( const AcDbObjectId& objId, const AcGePoint3d& spt, const AcGePoint3d& ept )
{
AcGeVector3d v = ept - spt;
if( v.length() < 100 ) return;
double angle = v.angleTo( AcGeVector3d::kXAxis, -AcGeVector3d::kZAxis );
WindDirection* pDir = new WindDirection( spt + v * 0.5, angle ); // 巷道中心位置
pDir->setRelatedGE( objId );
ArxUtilHelper::PostToModelSpace( pDir );
}
示例3: EffectRanDrawed
static void EffectRanDrawed(AcDbObjectId ttunel)
{
AcTransaction *pTrans = actrTransactionManager->startTransaction();
if ( 0 == pTrans ) return;
AcDbObject *pObj;
if (Acad::eOk != pTrans->getObject(pObj,ttunel,AcDb::kForRead)) return;
TTunnel *pTTunnel = TTunnel::cast(pObj);
if ( 0 == pTTunnel)
{
actrTransactionManager->abortTransaction();
return;
}
AcGePoint3d spt,ept;
pTTunnel->getSEPoint(spt,ept);
double angle = pTTunnel->getAngle();
actrTransactionManager->endTransaction();
AcDbObjectIdArray eTags;
DrawHelper::GetTagGEById2( ttunel, _T( "EffectRanTagGE" ), eTags );
if (!eTags.isEmpty())
{
ArxEntityHelper::EraseObjects( eTags, true );
}
AcGeVector3d v = ept - spt;
double diatance = v.length();
CString area,way;
if(!DataHelper::GetPropertyData(ttunel,_T("断面面积"),area)) return;
if(!DataHelper::GetPropertyData(ttunel,_T("通风方法"),way)) return;
double minDistan,maxDistan;
if(way.IsEmpty()) return;
if(area.IsEmpty()) return;
if (_T("压入式") == way || _T("长压短抽") == way)
{
minDistan = 4*sqrtf(_tstof(area));
maxDistan = 5*sqrtf(_tstof(area));
}
else
{
minDistan = 0;
maxDistan = 1.5*sqrtf(_tstof(area));
}
EffectRanTagGE *pTag = new EffectRanTagGE(ept,angle,minDistan,maxDistan,diatance*0.1);
if (0 == pTag) return;
pTag->setRelatedGE(ttunel);
if( !ArxUtilHelper::PostToModelSpace( pTag ) ) delete pTag;
}
示例4: drawSegment
void SimpleChimneyDraw::drawSegment( AcGiWorldDraw* mode, const AcGePoint3d& spt, const AcGePoint3d& ept )
{
AcGeVector3d v = ept - spt;
int n = ( int )( ( v.length() + m_space ) / ( m_length + m_space ) );
//acutPrintf(_T("\n可绘制的个数:%d"), n);
v.normalize();
AcGePoint3d pt = spt;
for( int i = 0; i < n; i++ )
{
DrawSegment( mode, pt, v, m_length, m_width, m_lineWidth );
pt = pt + v * ( m_length + m_space );
}
double ll = ( ept - pt ).length();
if( ll > m_length * 0.5 ) // 如果有长度的50%,则绘制一小段
{
DrawSegment( mode, pt, v, ll, m_width, m_lineWidth );
}
}
示例5: switch
// This function is called to update the entity based on the
// input values.
//
Adesk::Boolean
AsdkEllipseJig::update()
{
switch (mPromptCounter) {
case 0:
// At this time, mAxis contains the value of one
// endpoint of the desired major axis. The
// AcDbEllipse class stores the major axis as the
// vector from the center point to where the axis
// intersects the ellipse path (such as half of the true
// major axis), so we already have what we need.
//
mMajorAxis = mAxisPt - mCenterPt;
break;
case 1:
// Calculate the radius ratio. mRadiusRatio
// currently contains the distance from the ellipse
// center to the current pointer position. This is
// half of the actual minor axis length. Since
// AcDbEllipse stores the major axis vector as the
// vector from the center point to the ellipse curve
// (half the major axis), to get the radius ratio we
// simply divide the value currently in mRadiusRatio
// by the length of the stored major axis vector.
//
mRadiusRatio = mRadiusRatio / mMajorAxis.length();
break;
}
// Now update the ellipse with the latest setting.
//
mpEllipse->set(mCenterPt, mNormal, mMajorAxis,
mRadiusRatio);
return Adesk::kTrue;
}
示例6: acutPrintf
//.........这里部分代码省略.........
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"));
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 p3 = surfaceGeometry->evalPoint(AcGePoint2d(1.0, 0.0));
AcGePoint3d centre(((p0.x + p1.x) / 2.0),
((p0.y + p1.y) / 2.0),
((p0.z + p1.z) / 2.0));
示例7: Get_ArcMiddle
void Additional_Class::Get_ArcMiddle( AcDbObjectId PolyLineId, AcGePoint3dArray &Middle_List,AcGePoint3dArray &CenterListInput, LINEINFO &ArcInfoRList, LINEINFO &ArcInfoAList )
{
double PI=3.1415926535897932384626433832795;
AcDbEntity *pEnt_Temp = NULL;
Acad::ErrorStatus es = acdbOpenAcDbEntity(pEnt_Temp, PolyLineId, AcDb::kForRead);
if (es != Acad::eOk)
{
acutPrintf(_T("\nOPEN ENTITY ERROR"));
return;
}
if (!pEnt_Temp->isKindOf(AcDbPolyline::desc()))
{
acutPrintf(_T("\nENTITY NOT POLYLINE"));
return;
}
AcDbPolyline *pPolyLine = AcDbPolyline::cast(pEnt_Temp);
int num = pPolyLine->numVerts();
AcGePoint3d Start_temp_PT,End_temp_PT;
AcGePoint3dArray Center_List;
for (int index=0; index<num; index++)
{
if (pPolyLine->segType(index) == AcDbPolyline::kArc)
{
AcGeCircArc2d tempArc;
pPolyLine->getArcSegAt(index,tempArc);
AcGePoint2d CenterPoint;
CenterPoint = tempArc.center();
AcGePoint3d CenterPoint3d;
CenterPoint3d.set(CenterPoint.x, CenterPoint.y, 0);
Center_List.append(CenterPoint3d);
AcGePoint3d Start_temp_PT, End_temp_PT;
Start_temp_PT.set(tempArc.startPoint().x,tempArc.startPoint().y,0);
End_temp_PT.set(tempArc.endPoint().x,tempArc.endPoint().y,0);
AcGeVector3d tempVec;
tempVec = End_temp_PT - Start_temp_PT;
double tempVec_Len = tempVec.length();
tempVec.normalize();
tempVec = tempVec*(tempVec_Len/2);
AcGeVector3d CenterVec;
CenterVec = Start_temp_PT - CenterPoint3d;
CenterVec = CenterVec + tempVec;
AcGeLine2d CenterLine2d;
AcGePoint3d Middle_Pt_OnLine;
Middle_Pt_OnLine = CenterPoint3d+CenterVec;
AcGePoint2d middle2d;
middle2d.set(Middle_Pt_OnLine.x, Middle_Pt_OnLine.y);
CenterLine2d.set(CenterPoint, middle2d);
int s;
AcGePoint2d MiddlePT, pt2;
tempArc.intersectWith(CenterLine2d, s, MiddlePT, pt2);
AcGePoint3d MiddlePoint;
MiddlePoint.set(MiddlePT.x,MiddlePT.y,0);
Middle_List.append(MiddlePoint);
double StartAngle = tempArc.startAng();
double EndAngle = tempArc.endAng();
double Angle = EndAngle-StartAngle;
Angle = (180/PI)*Angle;
double Radius = tempArc.radius();
CString tempStr_Angle,tempStr_Radius,sita,du,banjing;
sita = "θ=";
du = "°";
banjing = "R=";
tempStr_Angle.Format(_T("%.1f"),Angle);
tempStr_Angle = sita+tempStr_Angle+du;
tempStr_Radius.Format(_T("%.1f"),Radius);
tempStr_Radius = banjing + tempStr_Radius;
ArcInfoRList.push_back(tempStr_Radius);
ArcInfoAList.push_back(tempStr_Angle);
}
}
CenterListInput = Center_List;
}