本文整理汇总了C++中AcGeVector3d::normalize方法的典型用法代码示例。如果您正苦于以下问题:C++ AcGeVector3d::normalize方法的具体用法?C++ AcGeVector3d::normalize怎么用?C++ AcGeVector3d::normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcGeVector3d
的用法示例。
在下文中一共展示了AcGeVector3d::normalize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jig
void
createSmiley()
{
AcGePoint3d cen;
struct resbuf rbFrom, rbTo;
ads_getpoint( NULL, "\nCenter point: ", asDblArray( cen ));
rbFrom.restype = RTSHORT;
rbFrom.resval.rint = 1; // from UCS
rbTo.restype = RTSHORT;
rbTo.resval.rint = 0; // to WCS
ads_trans( asDblArray( cen ), &rbFrom, &rbTo, Adesk::kFalse, asDblArray( cen ));
AcGeVector3d x = acdbHostApplicationServices()->workingDatabase()->ucsxdir();
AcGeVector3d y = acdbHostApplicationServices()->workingDatabase()->ucsydir();
AcGeVector3d normalVec = x.crossProduct( y );
normalVec.normalize();
SmileyJig jig( cen, normalVec );
jig.start();
}
示例2: extendByLength
void SingleTunnelDraw::extendByLength( double length )
{
AcGeVector3d v = m_endPt - m_startPt;
v.normalize();
m_endPt = m_endPt + v * length; // 修改末点坐标
}
示例3: 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;
}
示例4: DrawWindLibrary
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;
}
示例5: caclHeadPoint
AcGePoint3d DoubleTTunnelDraw::caclHeadPoint()
{
AcGeVector3d v = m_endPt - m_startPt;
v.normalize(); // 单位方向向量
v = v * m_distance;
return m_endPt + v;
}
示例6: extendByLength
void DoubleTunnelDraw::extendByLength( double length )
{
AcGeVector3d v = m_endPt - m_startPt;
v.normalize();
m_endPt = m_endPt + v * length; // 更新末点坐标
update(); // 更新其它参数
}
示例7: extendByLength
void GasPumpGEDraw::extendByLength( double length )
{
AcGeVector3d v = m_endPt - m_startPt;
v.normalize();
m_endPt = m_endPt + v * length; // 更新末点坐标
update();
}
示例8: caclEndPoint
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;
}
示例9: readPropertyDataFromGE
void GasPumpGEDraw::readPropertyDataFromGE( const AcStringArray& values )
{
CString strLenth;
strLenth.Format(_T("%s"),values[0].kACharPtr());
m_radius = _tstof(strLenth);
if( 0 >= m_radius ) m_radius = 3;
AcGeVector3d v = m_endPt - m_startPt;
v.normalize();
m_endPt = m_startPt + v * m_radius;
}
示例10: caclEndPoint
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;
}
示例11: acedGetPoint
// This function uses the AcEdJig mechanism to create and
// drag an ellipse entity. The creation criteria are
// slightly different from the AutoCAD command. In this
// case, the user selects an ellipse center point and then,
// drags to visually select the major and minor axes
// lengths. This sample is somewhat limited; if the
// minor axis ends up longer than the major axis, then the
// ellipse will just be round because the radius ratio
// cannot be greater than 1.0.
//
void
createEllipse()
{
// First, have the user select the ellipse center point.
// We don't use the jig for this because there is
// nothing to see yet.
//
AcGePoint3d tempPt;
struct resbuf rbFrom, rbTo;
acedGetPoint(NULL, _T("\nEllipse center point: "),
asDblArray(tempPt));
// The point we just got is in UCS coordinates, but
// AcDbEllipse works in WCS, so convert the point.
//
rbFrom.restype = RTSHORT;
rbFrom.resval.rint = 1; // from UCS
rbTo.restype = RTSHORT;
rbTo.resval.rint = 0; // to WCS
acedTrans(asDblArray(tempPt), &rbFrom, &rbTo,
Adesk::kFalse, asDblArray(tempPt));
// Now you need to get the current UCS z-Axis to be used
// as the normal vector for the ellipse.
//
AcGeVector3d x = acdbHostApplicationServices()->workingDatabase()
->ucsxdir();
AcGeVector3d y = acdbHostApplicationServices()->workingDatabase()
->ucsydir();
AcGeVector3d normalVec = x.crossProduct(y);
normalVec.normalize();
// Create an AsdkEllipseJig object passing in the
// center point just selected by the user and the normal
// vector just calculated.
//
AsdkEllipseJig *pJig
= new AsdkEllipseJig(tempPt, normalVec);
// Now start up the jig to interactively get the major
// and minor axes lengths.
//
pJig->doIt();
// Now delete the jig object, since it is no longer needed.
//
delete pJig;
}
示例12: subWorldDraw
Adesk::Boolean GasPumpGEDraw::subWorldDraw( AcGiWorldDraw* mode )
{
assertReadEnabled () ;
AcGeVector3d v = m_endPt - m_startPt;
v.normalize();
// 绘制箭头
DrawArrow( mode, m_startPt - v * 0.5 * m_radius, m_angle, 2*0.8660254037844386 * m_radius, 1.5 * m_radius * 0.9 );
DrawCircle( mode, m_startPt, m_radius, false );
AcGePoint3d spt,ept;
spt = m_startPt - v * 0.5 * m_radius + v * 1.5 * m_radius * 0.9;
ept = m_startPt - v * 0.5 * m_radius + v * 1.5 * m_radius;
DrawArrow( mode, spt, m_angle, 2*0.8660254037844386 * m_radius * 0.09, 1.5 * m_radius * 0.1 );
update();
return Adesk::kTrue;
}
示例13: 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 );
}
}
示例14: OffSetPolygon
// 闭合多边形向内偏移
bool OffSetPolygon( const AcGePoint3dArray& polygon, double offset, bool is_inner, AcGePoint3dArray& offset_polygon )
{
// 判断多边形方向
int dir = ClockWise( polygon );
if( dir == 0 ) return false;
// 向内或向外???
int c = ( is_inner ? -1 : 1 );
// 偏移方向角度
// 1) 与多边形的方向有关(dir)
// 2) 与要偏移的方向有关(is_inner)
double angle = c * dir * PI * 0.5;
bool ret = true;
int n = polygon.length();
for( int i = 0; i < n; i++ )
{
int p1 = ( n + i - 1 ) % n, p2 = i % n, p3 = ( i + 1 ) % n;
// 对点进行偏移
// 计算偏移向量
AcGeVector3d v1 = polygon[p2] - polygon[p1];
v1.normalize();
v1.rotateBy( angle, AcGeVector3d::kZAxis );
AcGeVector3d v2 = polygon[p3] - polygon[p2];
v2.normalize();
v2.rotateBy( angle, AcGeVector3d::kZAxis );
// 求两个向量的夹角
double angle = v1.angleTo( v2 );
double L = abs( offset / cos( angle * 0.5 ) );
AcGeVector3d v = v1 + v2;
v.normalize();
offset_polygon.append( polygon[p2] + v * L );
}
return ret;
}
示例15: caclBackGroundMinPolygon
void GasPumpGEDraw::caclBackGroundMinPolygon( AcGePoint3dArray& pts )
{
AcGeVector3d v0( AcGeVector3d::kXAxis );
//AcGeCircArc3d arc( m_insertPt, v,m_radius );
v0.rotateBy( m_angle, AcGeVector3d::kZAxis );
//AcGePoint3d cnt = arc.center();
AcGePoint3d spt = m_startPt + v0*m_radius;
AcGePoint3d ept = m_startPt - v0*m_radius;
v0.rotateBy(3.1415926/4,AcGeVector3d::kZAxis);
AcGePoint3d pt = m_startPt + v0*m_radius;
AcGeCircArc3d arc( spt, pt, ept );
AcGePoint3d cnt = arc.center();
double radius = arc.radius();
AcGeVector3d v = pt - cnt;
v.normalize();
DividArc( spt, ept, cnt + v * ( radius ), 90, pts );
DividArc( ept, spt, cnt - v * ( radius ), 90, pts );
}