UF_CURVE_create_spline
Defined in: uf_curve.h
int UF_CURVE_create_spline(UF_CURVE_spline_p_t spline_data, tag_p_t spline_tag, int * num_states, UF_CURVE_state_p_t * states )
overview 概述
A spline curve is created from the data in the spline_data structure.
The spline is a NURBS (NonUniform Rational B-Spline) curve. See the description of the structure for a basic description of the data items.
If the is_rational field is nonzero, the weights must be positive. If it is 0 (non-rational), the weights are ignored.
If the is_spcurve field is nonzero, the Z coordinates are ignored.
NURBS curves need not have Bezier end conditions (be clamped).
NX currently requires that the parameter range of a spline be 0 to 1. The User Function API normalizes the knot vector and returns a state indicating the parameter transformation thus induced.
The multiplicity of a knot is the number of times the same value appears in the sequence. The multiplicity of the end knots cannot exceed the order of the spline; the multiplicity of interior knots cannot exceed order-1. The knot sequence must be monotonically increasing. These problems and degeneracies are fixed using tolerances assigned by Open API.
Utilities are provided to assist in removing many of these conditions from your splines using larger tolerances.
Periodicity is determined directly from the spline data by Open API on create. A periodic spline is identified as follows:
-
Evaluate the location and tangent vectors at the start and end parameter values. -
If the location vectors are the same, it is closed and is made periodic, but it might not be smooth at the closure. -
If the tangent vectors have the same direction, it is smooth (G1). If the tangent vectors also have the same length, it is parameter smooth (C1). -
If the spline is rational, and it is also C1 in homogeneous space, it can be unclamped. If the spline is not rational, Cartesian space is equivalent to homogeneous space and so it can be unclamped. -
If it can be unclamped, the closure is made as high as the data allows (up to degree - 1). If the closure cannot be made C1, it is made G1. If it cannot be made G1, it is left closed, but not smooth. (Unclamping applies knot removal to both ends of the spline. NX chooses knot intervals for this process that yield wrap-around control points if the closure is C1.)
The period is determined from the parameter range as defined above, largest minus smallest allowed values.
If the closure for a periodic curve must be checked using tolerances larger than Open APIs defaults, use UF_CURVE_smooth_spline_data. If degeneracies and knot problems must be fixed using tolerances larger than Open APIs defaults, use UF_CURVE_fix_spline_data.
Specific errors: spline contains fixable problems, or unfixable problems. An unfixable overrides the fixable return code.
样条曲线是根据 spline _ data 结构中的数据创建的。样条是 NURBS (非均匀有理 B 样条)曲线。有关数据项的基本说明,请参见结构说明。如果是 _ 有理域是非零的,权值必须是正的。如果为0(非理性) ,则忽略权重。如果 is _ spCurve 字段非零,则忽略 Z 坐标。NURBS 曲线不需要有贝塞尔端部条件(被夹紧)。NX 当前要求样条的参数范围为0到1。用户函数 API 规范化节点向量并返回一个状态,指示由此引发的参数转换。一个结的多重性是同一值在序列中出现的次数。末端节点的多样性不能超过样条函数的阶; 内部节点的多样性不能超过1阶。绳结序列必须是单调增加的。这些问题和退化是固定使用公差分配的开放 API。提供实用程序,以协助消除这些条件从您的样条使用更大的公差许多。周期性是由创建时的 OpenAPI 直接从样条数据确定的。一个周期样条被识别如下: 1。计算开始和结束参数值的位置和切向量。2.如果位置向量是相同的,那么它是闭合的,并且是周期性的,但是它在闭合时可能不是平滑的。3.如果切向量的方向相同,它是光滑的(G1)。如果切向量也具有相同的长度,则为参数平滑(C1)。4.如果花键是有理的,而且它的齐性空间也是 C1,它就可以松开。如果样条曲线不是有理的,笛卡尔空间等价于齐性空间,因此它可以被解开。5.如果可以取消夹紧,则在数据允许的范围内尽可能高地设置闭包(直到达到1度)。如果闭包不能做成 C1,那么就做成 G1。如果它不能成为 G1,它是封闭的,但不是光滑的。(取消夹紧适用于结移除花键的两端。NX 为这个过程选择节点间隔,如果闭包是 C1,则产生环绕控制点。)周期由上面定义的参数范围确定,最大值减去允许的最小值。如果周期曲线的闭包必须使用大于 Open API 默认值的公差进行检查,则使用 UF _ CURVE _ ooth _ spline _ data。如果必须使用大于 Open API 默认值的公差来修复退化和节点问题,则使用 UF _ CURVE _ fix _ spline _ data。具体错误: 样条包含可修复的问题,或不可修复的问题。不可修复的重写可修复的返回代码。
UFUN例子
获取源码例子请搜索 里海NX二次开发3000例专栏
parameters 参数
| UF_CURVE_spline_p_t | spline_data | Input | Address of spline structure describing the desired curve. 描述所需曲线的样条结构地址。 |
| tag_p_t | spline_tag | Output | Tag of curve is returned 返回曲线标记 |
| int * | num_states | Output | Number of entries in states array 状态数组中的条目数 |
| UF_CURVE_state_p_t * | states | Output to UF_free | Array of states indicating what kinds of problems are present; if NULL no state return is needed. This array must be freed by calling UF_free. 状态数组,指示存在哪些类型的问题; 如果为 NULL,则不需要状态返回。必须通过调用 UF _ free 来释放此数组。 |