[vtkusers] Curve / Equal Subdivision
Jean-Hugues Royer
jhroyer at joher.com
Tue Jul 10 15:13:32 EDT 2012
Hi,
In fact I create a contour widget (contourwidget) to draw the curve
(with a vtkBezierContourLineInterpolator) and to show the problem I
trace a straight line (instead of a curve) with two single points
(begining / end) parallel to the X axis and with Z = 0.
Then I create a vtkSplineFilter (splinefilter) and do a
splinefilter->Setinput(countourwidget->GetContourRepresentation()->GetContourRepresentationAsPolyData()).
Then I call splinefilter->SetSubdivideToLength() and
splinefilter->SetLength(D) with desired distance (D) between points and
finally splinefilter->Update().
Then I get every points by calling
splinefilter->GetOutput()->GetPoint(n) and compute the distance
consecutive points: Sqrt( (x2-x1)^2 + (y2-y1)^2 + (z2-z1) ^ 2).
When I do that with a straight line the distance is always different
than the one I asked, when I do that with a curve (a simple arc) only
the first and last ~20 points have a different distance.
So far the workaround I found is to call SetLength(D/100) (so I get 100x
more points than needed) and I manually select the points among them
which have almost distance D between them, it works but it requires more
computation and it is not totally accurate.
I don't think it's related but I'm using Activiz, and the straight line
I use has a total length of 95mm and I ask for distance (D) of
0.18648mm. (I tried different values of D and I get the same issue)
Regards.
On 10/07/2012 17:52, Jana Sefcikova wrote:
> Hi,
> can I ask you , how did you check whether they are or are not equally
> distributed ?
> Also what was length of the curve and distance, in the case when you
> get good distribution except corner points?
>
> Jana
More information about the vtkusers
mailing list