void DoubleTunnelDraw::caclEndPoint( AcGePoint3d& endPt1, AcGePoint3d& endPt2 ) { AcGeVector3d v = m_endPt - m_startPt; v.normalize(); v.rotateBy( PI * 0.5, AcGeVector3d::kZAxis ); endPt1 = m_endPt + v * m_width * 0.5; v.rotateBy( PI, AcGeVector3d::kZAxis ); endPt2 = m_endPt + v * m_width * 0.5; }
void DoubleLine::caclEndPoint( AcGePoint3d& endPt1, AcGePoint3d& endPt2 ) { AcGeVector3d v = m_ept - m_spt; v.normalize(); v.rotateBy( PI * 0.5, AcGeVector3d::kZAxis ); endPt1 = m_ept + v * m_width * 0.5; v.rotateBy( PI, AcGeVector3d::kZAxis ); endPt2 = m_ept + v * m_width * 0.5; }
void DrawCmd::DrawWindLibrary( void ) { AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一条巷道:" ) ); if( objId.isNull() ) return; if( !ArxUtilHelper::IsEqualType( _T( "LinkedGE" ), objId ) ) return; AcGePoint3d pt,insertPt; double angle; if( !ArxUtilHelper::PromptPt( _T( "\n请指定风库的插入点坐标:" ), pt ) ) return; if( !GetClosePtAndAngle( objId, pt, angle ) ) return; AcGeVector3d v = AcGeVector3d(AcGeVector3d::kXAxis); v.rotateBy(angle - PI/2,AcGeVector3d::kZAxis); v.normalize(); insertPt = pt + v * 60; WindLibrary* pWindLib = new WindLibrary( insertPt, angle ); if( pWindLib == 0 ) return; pWindLib->setRelatedGE( objId ); // 关联巷道 // 初始化并提交到数据库 if( !ArxUtilHelper::PostToModelSpace( pWindLib ) ) delete pWindLib; }
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; }
AcGeVector3d DoubleLine::getEndPointInExtendAngle() const { AcGeVector3d v = m_endPt - m_startPt; v.rotateBy( PI, AcGeVector3d::kZAxis ); // 旋转180度 return v; }
static void DrawSegment( AcGiWorldDraw* mode, const AcGePoint3d& spt, const AcGeVector3d& v, double length, double width, double lineWidth ) { AcGePoint3d ept = spt + v * length; DrawPolyLine( mode, spt, ept, lineWidth ); AcGeVector3d vv = v; vv.rotateBy( PI / 2, AcGeVector3d::kZAxis ); AcGePoint3d spt1, spt2; spt1 = spt + vv * width * 0.5; vv.rotateBy( PI, AcGeVector3d::kZAxis ); spt2 = spt + vv * width * 0.5; DrawPolyLine( mode, spt1, spt2, lineWidth ); AcGePoint3d ept1, ept2; ept1 = ept + vv * width * 0.5; vv.rotateBy( PI, AcGeVector3d::kZAxis ); ept2 = ept + vv * width * 0.5; DrawPolyLine( mode, ept1, ept2, lineWidth ); }
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; }
Acad::ErrorStatus ArxDbgDbEntity::setRotation(double rot) { assertWriteEnabled(); AcGeVector3d xAxis; ArxDbgUtils::getEcsXAxis(m_zDir, xAxis); // get AutoCAD's arbitrary X-Axis m_xDir = xAxis.rotateBy(rot, m_zDir); // factor in rotation angle m_xDir.normalize(); return Acad::eOk; }
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; // 修改圆弧的末点 }