HALCON Reference Manual 10.0.2
Table of Contents / XLD / Creation ClassesClassesClasses | | | Operators

gen_contour_nurbs_xldT_gen_contour_nurbs_xldgen_contour_nurbs_xldGenContourNurbsXldGenContourNurbsXld (Operator)

Name

gen_contour_nurbs_xldT_gen_contour_nurbs_xldgen_contour_nurbs_xldGenContourNurbsXldGenContourNurbsXld — Transform a NURBS curve into an XLD contour.

Signature

gen_contour_nurbs_xld( : Contour : Rows, Cols, Knots, Weights, Degree, MaxError, MaxDistance : )

Herror T_gen_contour_nurbs_xld(Hobject* Contour, const Htuple Rows, const Htuple Cols, const Htuple Knots, const Htuple Weights, const Htuple Degree, const Htuple MaxError, const Htuple MaxDistance)

Herror gen_contour_nurbs_xld(Hobject* Contour, const HTuple& Rows, const HTuple& Cols, const HTuple& Knots, const HTuple& Weights, const HTuple& Degree, const HTuple& MaxError, const HTuple& MaxDistance)

HXLDCont HXLDCont::GenContourNurbsXld(const HTuple& Rows, const HTuple& Cols, const HTuple& Knots, const HTuple& Weights, const HTuple& Degree, const HTuple& MaxError, const HTuple& MaxDistance)

void HOperatorSetX.GenContourNurbsXld(
[out] IHUntypedObjectX*Contour, [in] VARIANT Rows, [in] VARIANT Cols, [in] VARIANT Knots, [in] VARIANT Weights, [in] VARIANT Degree, [in] VARIANT MaxError, [in] VARIANT MaxDistance)

void HXLDContX.GenContourNurbsXld(
[in] VARIANT Rows, [in] VARIANT Cols, [in] VARIANT Knots, [in] VARIANT Weights, [in] Hlong Degree, [in] VARIANT MaxError, [in] VARIANT MaxDistance)

static void HOperatorSet.GenContourNurbsXld(out HObject contour, HTuple rows, HTuple cols, HTuple knots, HTuple weights, HTuple degree, HTuple maxError, HTuple maxDistance)

void HXLDCont.GenContourNurbsXld(HTuple rows, HTuple cols, HTuple knots, HTuple weights, int degree, HTuple maxError, HTuple maxDistance)

void HXLDCont.GenContourNurbsXld(HTuple rows, HTuple cols, string knots, string weights, int degree, double maxError, double maxDistance)

Description

gen_contour_nurbs_xldgen_contour_nurbs_xldgen_contour_nurbs_xldGenContourNurbsXldGenContourNurbsXld generates an XLD ContourContourContourContourcontour that approximates a NURBS curve (non-uniform rational B-Spline curve). The NURBS curve is specified by its DegreeDegreeDegreeDegreedegree, a control polygon (via RowsRowsRowsRowsrows and ColsColsColsColscols), a WeightsWeightsWeightsWeightsweights vector and a KnotsKnotsKnotsKnotsknots vector.

The DegreeDegreeDegreeDegreedegree of the curve determines the grade of differentiability of the curve. The curve lies within the convex hull of its control polygon (RowsRowsRowsRowsrows,ColsColsColsColscols). The weights in WeightsWeightsWeightsWeightsweights determine how much the curve is attracted by the individual control points (RowsRowsRowsRowsrows,ColsColsColsColscols). A WeightsWeightsWeightsWeightsweights vector with equal weights for all control points is generated if 'auto'"auto""auto""auto""auto" is chosen. The KnotsKnotsKnotsKnotsknots vector describes the domain of the curve. Typically, this parameter can be set to 'auto'"auto""auto""auto""auto".

The accuracy of the generated ContourContourContourContourcontour depends on the two parameters MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistance and MaxErrorMaxErrorMaxErrorMaxErrormaxError. MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistance limits the maximum distance of two subsequent ContourContourContourContourcontour points. The maximum distance between the generated ContourContourContourContourcontour and the actual NURBS curve is limited to MaxErrorMaxErrorMaxErrorMaxErrormaxError. By default the approximation must fulfill both constraints, but it is possible to set one of these parameters to 'omit'. The lower MaxErrorMaxErrorMaxErrorMaxErrormaxError and MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistance are chosen the better is the approximation of the curve. Note that all ContourContourContourContourcontour points lie exactly on the curve (except for numerical inaccuracies).

Definition

A NURBS curve C of degree p is given by

          n
         sum N_{i,p}(u) w_{i} P_{i}
         i=0
  C(u)= ----------------------------, u in [u_{p},u_{n}]
          n
         sum N_{i,p}(u) w_{i}
         i=0

The basis functions N_{i,p} are defined by

                / 1      if u_{i} <= u < u_{i}+1
  N_{i,0} (u) = |
                \ 0      otherwise

                   u - u_{i}                         u_{i+p+1} - u
  N_{i,p} (u) = ---------------- N_{i,p-i} (u) + --------------------- N_{i+1,p-1} (u)
                u_{i+p} - u_{i}                   u_{i+p+1} - u_{i+1}

Thus, each NURBS curve is determined by its DegreeDegreeDegreeDegreedegree p, its control Polygon P_{0},...,P_{n-1} (RowsRowsRowsRowsrows and ColsColsColsColscols), its weight vector w = (w_{0}, ..., w_{n-1}) (WeightsWeightsWeightsWeightsweights), and its knot vector u = (u_{0},..., u_{n+p}) (KnotsKnotsKnotsKnotsknots).

The grade of differentiabilty of the curve is set via the degree p. At least p+1 control points P_{i} are required to form a valid curve. The knot vector u describes the domain of the curve. Its length must be n+p+1 and its entries must be monotonically increasing. Every entry u_{i} stands for a knot between the curve segments [u_{i-1}, u_{i}) and [u_{i},u_{i+1}). Each curve segment [u_{i}, u_{i+1}) lies within the convex hull of the control points P_{i-p}, .., P_{i}. For every curve segment of length zero, the differentiability at knot k decreases. The number of occurrences of each knot in the knot vector is called multiplicity. The maximum multiplicity of one knot is p. Only the start and the end point's multiplicity can be p+1 (which in fact is the case for most curves, because in this case start and end point of the curve correspond to the first respectively last point of the control polygon). If start and/or end point do not have full multiplicity, the domain of the curve is restricted to [u_{p},u_{n}]. The weights w_{i} determine the influence of the individual control Points P_{i} on the curve.

Closed Curves: If start and end point are equal (P_{0}=P_{n-1}) and KnotsKnotsKnotsKnotsknots is set to 'auto', the curve is closed automatically such that all knots feature multiplicity one. Note that in this case the length of WeightsWeightsWeightsWeightsweights is required to be n-1.

Parallelization

Parameters

ContourContourContourContourcontour (output_object)  xld_cont objectHXLDContHXLDContHXLDContXHobject *

The contour that approximates the NURBS curve.

RowsRowsRowsRowsrows (input_control)  coordinates.y-array HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Row coordinates of the control polygon.

Number of elements: (Rows == Cols) && (Rows >= (Degree + 1))

ColsColsColsColscols (input_control)  coordinates.x-array HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Column coordinates of the control polygon.

Number of elements: (Cols == Rows) && (Cols >= (Degree + 1))

KnotsKnotsKnotsKnotsknots (input_control)  string(-array) HTupleHTupleVARIANTHtuple (string / real) (string / double) (char* / double) (BSTR / double) (char* / double)

The knot vector u.

Default value: 'auto' "auto" "auto" "auto" "auto"

Suggested values: 'auto'"auto""auto""auto""auto"

WeightsWeightsWeightsWeightsweights (input_control)  string(-array) HTupleHTupleVARIANTHtuple (string / real) (string / double) (char* / double) (BSTR / double) (char* / double)

The weight vector w.

Number of elements: Weights == Rows

Default value: 'auto' "auto" "auto" "auto" "auto"

Suggested values: 'auto'"auto""auto""auto""auto"

Restriction: Weights > 0.0

DegreeDegreeDegreeDegreedegree (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

The degree p of the NURBS curve.

Default value: 3

Suggested values: 2, 3, 4, 5

Restriction: Degree >= 2

MaxErrorMaxErrorMaxErrorMaxErrormaxError (input_control)  real HTupleHTupleVARIANTHtuple (real / string) (double / string) (double / char*) (double / BSTR) (double / char*)

Maximum distance between the NURBS curve and its approximation.

Default value: 1.0

Suggested values: 'omit'"omit""omit""omit""omit", 1.0, 2.0, 3.0, 4.0, 5.0

Restriction: MaxError > 0.0

MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistance (input_control)  real HTupleHTupleVARIANTHtuple (real / string) (double / string) (double / char*) (double / BSTR) (double / char*)

Maximum distance between two subsequent ContourContourContourContourcontour points.

Default value: 5.0

Suggested values: 'omit'"omit""omit""omit""omit", 1.0, 2.0, 3.0, 4.0, 5.0

Restriction: MaxDistance > 0.0

Example (HDevelop)

* use a polygon XLD contour as control polygon and approximate
* the NURBS curve as contour

get_contour_xld(Polygon, Row, Col)
gen_contour_nurbs_xld(NURBSContour, Row, Col, 'auto', 'auto', 3, 1.0, 10.0)

Possible Predecessors

gen_nurbs_interpgen_nurbs_interpgen_nurbs_interpGenNurbsInterpGenNurbsInterp

Possible Successors

gen_polygons_xldgen_polygons_xldgen_polygons_xldGenPolygonsXldGenPolygonsXld

References

L. Piegl, W. Tiller: ”The NURBS Book”, 2nd Edition, Springer, 1997.

Module

Foundation


Table of Contents / XLD / Creation ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH