高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】extrusion vectors
extrusion vectors
extrusion vectors
i'm not sure how to handle extrusion vectors. to get the coordinates of an oddbarc, for example, do i just call?:
oddbarcptr parc = oddbarc::cast(pent);
parc->transformby(odgematrix3d:lanetoworld(parc->normal());
is this how you do it? any help would be appreciated.
void maybe(oddbarcptr parc)
{
odgematrix3d coordsysmat;
odgevector3d xaxis, yaxis, zaxis, normal, tmpnormal;
normal = parc->normal();
zaxis = normal;
tmpnormal = normal;
if ((fabs(normal.x) < 0.015625) && (fabs(normal.y) < 0.015625))
{
tmpnormal.x = normal.z;
tmpnormal.y = 0.0;
tmpnormal.z = -normal.x;
normal = tmpnormal;
}
else
{
tmpnormal.x = normal.y;
tmpnormal.y = normal.x;
tmpnormal.z = 0.0;
}
normal = tmpnormal;
xaxis = normal.perpvector();
yaxis = zaxis.crossproduct(xaxis); // get the y axis
coordsysmat.setcoordsystem(odgepoint3d::korigin, xaxis, yaxis, normal);
parc->transformby(coordsysmat);
}
when the dxf data is read in from file the coordinates are placed into wcs using towcscenter(). so the data you retrieve from your arc should already be in the wcs.
just for you info- these are the two methods we apply to switch between wcs and ocs for circle derived entities:
odgepoint3d m_center;
void towcscenter()
{
if (normal() != odgevector3d::kzaxis)
{
m_center.transformby(odgematrix3d:lanetoworld(no rmal()));
}
}
odgepoint3d ocscenter() const
{
odgepoint3d rescenter(m_centere);
if (normal() != odgevector3d::kzaxis)
{
rescenter.transformby(odgematrix3d::worldtoplane(n ormal()));
}
return rescenter;
}
i understand your respond to mean that i do not have to transform the oddbarc. am i correct is saying that all arcs in a dxf file are drawn counter-clockwise? if so, the problem i am having is that all arcs with an extrusion vector of (0,0,-1) seem to be going clockwise.
post me an example to look at.
all the arcs with a normal of (0,0,-1) are going clockwise instead of counter-clockwise.
acdbarc
arc (-399, -148.5, 0) to (-399, -162.5, 0) center (-399, -155.5, 0)
normal: (0, 0, 1)
start angle: 1.5708
end angle: 4.71239
acdbarc
arc (-399, -160.75, 0) to (-399, -150.25, 0) center (-399, -155.5, 0)
normal: (0, 0, -1)
start angle: 4.71239
end angle: 1.5708
acdbarc
arc (-360.026, -154.903, 0) to (-367, -148.5, 0) center (-367, -155.5, 0)
normal: (0, 0, 1)
start angle: 0.0853085
end angle: 1.5708
acdbarc
arc (-367, -150.25, 0) to (-367, -160.75, 0) center (-367, -155.5, 0)
normal: (0, 0, -1)
start angle: 1.5708
end angle: 4.71239
acdbarc
arc (-367, -162.5, 0) to (-360, -155.5, 0) center (-367, -155.5, 0)
normal: (0, 0, 1)
start angle: 4.71239
end angle: 0
attached files (30.7 kb, 17 views)
|