高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】splines - Isperiodic
splines - isperiodic
splines - isperiodic
hello,
is method "isperiodic()" implemented for splines (oddbspline entity)?
even if i create periodic spline, this function returns always false.
if this method is not yet implemented, i would like to know if it will be in next releases?
arx reference tells about oddbcurve::isperiodic() :
"this function returns true if, and only if, the curve has an infinite range in both directions and there is a period value t such that there is a point on curve at (u + t) = point on curve (u), for any parameter u. if the curve is not periodic, then adesk::kfalse is returned.
the default implementation returns adesk::kfalse."
spline curve always has finite range [firstknot, lastknot), so for oddbspline this function always return false.
sincerely yours,
george udov
thanks for the answer george.
nevertheless it seems strange why there is periodic flag in dxf file structure, and why getnurbsdata returns also periodic value, if spline can not be periodic by it's definition.
i also found another strange behavior of splines.
if i call getnurbsdata(...) and spline is not closed, method returns unchanged parameter closed. it should set it to false.
example: (if following code is executed on a spline which is not closed, parameter closed stays the same - true)
bool closed = true;
psplineent->getnurbsdata(a,b,closed,c,d,e,f,g,h)
// closed is true - it should be set to false
regards, tomaz
quote:
originally posted by tomaz juretic
nevertheless it seems strange why there is periodic flag in dxf file structure, and why getnurbsdata returns also periodic value, if spline can not be periodic by it's definition.
there are two means of term "periodic". first mean is as i wrote above - it is "periodic as curve". function oddbspline::isperiodic is implementation of oddbcurve::isperiodic, it is curve's function, so it uses this mean.
second mean is spline-specific, and this mean corresponds to periodic flag of spline in dxf file structure. getnurbsdata is oddbspline specific function, so it uses this mean.
quote:
originally posted by tomaz juretic
i also found another strange behavior of splines.
if i call getnurbsdata(...) and spline is not closed, method returns unchanged parameter closed. it should set it to false.
it is a bug, i fixed it, fix will be available in maintenance release (it is expected soon). thank you for feedback, tomaz.
sincerely yours,
george udov
hello,
quote:
originally posted by george udov
second mean is spline-specific, and this mean corresponds to periodic flag of spline in dxf file structure. getnurbsdata is oddbspline specific function, so it uses this mean.
if method getnurbsdata sets periodic parameter depending on flag 70 of spline entity, why it returns false for attached example file:
spline flag in this file is:
70
11
(8 - planar, 2 - periodic and 1 - closed)
is there some additional checking if spline is really periodic or not?
(attached example file was created with autocad 2004)
regards, tomaz
attached files (46.7 kb, 7 views)
dear tomaz,
i've just fixed this defect.
btw, these spline's falgs (closed, periodic) aren't really need for rendering or for getparamatpoint/getpointatparam functionality, so we didn't pay many attention for them. we would appreciate if you explain, why these flags are so important for you?
sincerely yours,
george udov
dear george,
the usage of this periodic flag is not critical for me, but it would be nice if it works. (if it works i will use it, otherwise i can get around)
my problem is:
i am working on application, which converts dxf/dwg file format to another cad format. this format uses three type of splines (opened, closed and periodic closed). firstly i thought, that closed and closed periodic splines are in fact the same ones, but than i figured out, that opened and closed splines are treated the same way (as opened) - and periodic closed as real closed splines.
my application takes splines from dxf file. if spline is closed, it creates true periodic closed spline and fills data back to library (changes control points and knot vector of spline - and of course my application set also periodic flag).
than, later on it takes the data out of dwgdirect library and fills it into destination file (converted file).
as you can se, i am using dwgdirect library also for container of modified elements. so i do not actually read periodic flag from dxf file - because this format does not have same definition of periodic spline as i need. but i write the new (periodic spline created by sisl2d library back to opendwg and later on i read it back). here i need the information if this is periodic spline. of course this can be solved in many ways (without help of dwgdirect), but if periodic flag for spline entity can be read from the library i do not have to do workarounds.
periodic bsplines in our destination cad file format are defined the same way as closed splines in following documents:
i am sending you an example file with closed periodic bspline in attached file.
(closed periodic, means closed in terms of html links, which i wrote above)
while i am sending you this file i have another question. this spline is recognized as closed in autocad, but dwgdirect library does recognize it as open spline. is this meant to be so, or is this a bug?
thanks for all you effort and great help george.
regards, tomaz
i forgot to attach the file
attached files (15.8 kb, 9 views)
quote:
originally posted by tomaz juretic
while i am sending you this file i have another question. this spline is recognized as closed in autocad, but dwgdirect library does recognize it as open spline. is this meant to be so, or is this a bug?
this is because function oddbcurve::isclosed() was not implemented in common case (i've implemented it). btw, according arx reference, oddbcurve::isclosed() returns true if and only if its start point is identical to its end point.
as i understand, your format minds that periodic bspline is bspline that
1) first and last (degree+1) knots are coincident
2) start and end points are equal (in this case this condition is equal to "start and end control points are equal", due to (1) ).
and it seems that acad minds so too. but what acad means as closed bspline... interesting question... maybe just like closed curve - start and end points are coincident (and so any periodic spline is closed, but not any closed spline is periodic)... do you know? i think i'll verify in future...
sincerely yours,
george udov
quote:
originally posted by george udov
and it seems that acad minds so too. but what acad means as closed bspline... interesting question... maybe just like closed curve - start and end points are coincident (and so any periodic spline is closed, but not any closed spline is periodic)... do you know? i think i'll verify in future...
according to arx reference:
if the spline is to be periodic, then periodic should be adesk::ktrue. this parameter should only be set to adesk::ktrue if the spline is closed. a periodic spline is a spline with period t such that the point at parameter value t + t is the same as the point at parameter value t for any value of t.
so, periodic splines are always closed ones. and of course closed spline is not necessarily periodic.
i do not know how autocad works, but it seems, that it can recognize also periodic splines as closed ones. if you check what happens when such spline is saved by autocad, you will see, that knot vector, and control points are changed.
regards, tomaz
|