几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-06, 10:01 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】pline and pxform

pline and pxform
pline and pxform
i am using vectorization in dd 1.13.02.
how do i interpret the odgematrix3d* pxform parameter passed into pline() proc during vectorization. no other function(polylineproc, circleproc etc.) get the matrix parameter.
is the view direction not considered when some entity gets vectorized as pline(eg. donut) ??
i use the following code to read plines:
code:
void exgssimpledevice:lineproc(const odgipolyline& lwbuf,
const odgematrix3d* pxform,
oduint32 i,
oduint32 numsegs){

if(numsegs == 0)
numsegs = lwbuf.numverts() - 1;
//double lwidth;

oduint32 nbpoints = numsegs + 1;

odgevector3d normal = lwbuf.normal();
odgipolyline::segtype segtype = lwbuf.segtype(fromindex);
for(oduint32 segindex = fromindex+1; segindex < nbpoints; ++segindex)
{
//segtype = lwbuf.segtype(segindex);
if(segtype == oddbpolyline::karc)
{
odgecircarc3d arc;
lwbuf.getarcsegat(segindex - 1, arc);
odgepoint3darray bezier;
beziercurve::arctobezier(bezier, arc);
//draw bezier
}
else
{
odgepoint2d pt;
lwbuf.getpointat(segindex, pt);
pathsegment segm;
segm.in.h = segm.out.h = segm.p.h = pt.x;
segm.in.v = segm.out.v = segm.p.v = pt.y;
//draw segm
}
segtype = lwbuf.segtype(segindex);

}
//segtype = lwbuf.segtype(segindex);
if(segtype == oddbpolyline::karc)
{
odgecircarc3d arc;
lwbuf.getarcsegat(segindex - 1, arc);
odgepoint3darray bezier;
beziercurve::arctobezier(bezier, arc);
//draw bezier
}
if(lwbuf.isclosed())
m_isclosed = true;
}

pxform is transform that you must apply to pline geometry before drawing (if exists).
this parameter was introduced to pline primitive only to reach compatibility of our rendering with autocad's one - linetype should be applied to pline primitive before any transforms. for other primitives linetype and xform are applied in order of corresponding conveyor nodes.
sincerely yours,
george udov

are the line segments in view coordinates?
i don't want to handle linetypes. can i simply get the correct results by applying pxform to each line segment?
something like:
plineproc(...)
{
// loop for all segments
{
// get segment type
// call correct lwbuf.get*segat() to get appropriate segment
// do {odgecircarc3d/odgepoint3d}.transformby(*pxform)
// map to app's native entity
}

but you should also take widths into account.
btw, odgigeometrysimplifer:lineproc was implemented exactly for turning this primitive to ones that simpler.
sincerely yours,
george udov
but plineproc() in odgigeometrysimplifer converts arcs into polyline also. something which we don't want.
on the original point, do we need to apply any other transform or is what i wrote earlier sufficent (except widths, of course)?
also, most of the get*segat() have 2 versions. one which returns a 2d parameter and one which returns a 3d parameters.
is the 3d one in view coordinates and 2d one in ocs?

quote:
on the original point, do we need to apply any other transform or is what i wrote earlier sufficent (except widths, of course)?
after transforming by xform you will get geometry in same coordinates with other primitives you get to this conveyor node.
what these coordinates are (world, view, device, etc) depends on conveyor.
sincerely yours,
george udov

quote:
originally posted by varunsnair
also, most of the get*segat() have 2 versions. one which returns a 2d parameter and one which returns a 3d parameters.
is the 3d one in view coordinates and 2d one in ocs?
2d are in ocs. 3d are those i written in previous message.
you can get 3d from 2d by adding elevation and transforming by matrix planetoworld(normal).
sincerely yours,
george udov
that explains it. i've been using some 2d one's and getting unexpected results.
thanks.
i noticed that there is no getpointat() variant with 3d parameter. does that mean that the point we get (2d) will always be in ucs?
if i get what you're suggesting, then we have to do:
1. get 2d point
2. make point 3d (p3d.x = p2d.x; p3d.y = p2d.y; p3d.z = pline.elevation()
3. apply planetoworld transform to the 3d point.
am i correct?
also in that case what is the order of applications of transforms? do we apply pxform first or the planetoworld transformation first?

yes, it always will be in ocs (you seems to be misprinted).
quote:
if i get what you're suggesting, then we have to do:
1. get 2d point
2. make point 3d (p3d.x = p2d.x; p3d.y = p2d.y; p3d.z = pline.elevation()
3. apply planetoworld transform to the 3d point.
am i correct?
yes.
quote:
also in that case what is the order of applications of transforms? do we apply pxform first or the planetoworld transformation first?
of course, planetoworld transformation first. then pxform.
sincerely yours,
george udov
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】memory stomp of the transformation matrix associated wit yang686526 DirectDWG 0 2009-05-06 05:41 PM


所有的时间均为北京时间。 现在的时间是 06:17 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多