Castle Game Engine: CastleNURBS

# Unit CastleNURBS
Description | Uses | Classes, Interfaces, Objects and Records | Functions and Procedures | Types | Constants | Variables
## Description Common utilities for NURBS curves and surfaces. ## Uses SysUtils CastleUtils CastleVectors CastleBoxes ## Overview ### Functions and Procedures
`function ActualTessellation(const Tessellation: Integer; const Dimension: Cardinal): Cardinal;`
`function NurbsCurvePoint(const Points: PVector3Single; const PointsCount: Cardinal; const U: Single; const Order: Cardinal; Knot, Weight: TDoubleList; Tangent: PVector3Single): TVector3Single;`
`function NurbsCurvePoint(const Points: TVector3SingleList; const U: Single; const Order: Cardinal; Knot, Weight: TDoubleList; Tangent: PVector3Single): TVector3Single;`
`function NurbsSurfacePoint(const Points: TVector3SingleList; const UDimension, VDimension: Cardinal; const U, V: Single; const UOrder, VOrder: Cardinal; UKnot, VKnot, Weight: TDoubleList; Normal: PVector3Single): TVector3Single;`
`procedure NurbsKnotIfNeeded(Knot: TDoubleList; const Dimension, Order: Cardinal; const Kind: TNurbsKnotKind);`
`function NurbsBoundingBox(Point: TVector3SingleList; Weight: TDoubleList): TBox3D;`
`function NurbsBoundingBox(Point: TVector3SingleList; Weight: TSingleList): TBox3D;`
`function NurbsBoundingBox(Point: TVector3SingleList; Weight: TDoubleList; const Transform: TMatrix4Single): TBox3D;`
`function NurbsBoundingBox(Point: TVector3SingleList; Weight: TSingleList; const Transform: TMatrix4Single): TBox3D;`
### Types
`TNurbsKnotKind = (...);`
## Description ### Functions and Procedures
`function ActualTessellation(const Tessellation: Integer; const Dimension: Cardinal): Cardinal;`
Calculate the tessellation (number of NURBS points generated). This follows X3D spec for "an implementation subdividing the surface into an equal number of subdivision steps". Give value of tessellation field, and count of controlPoints. Returned value is for sure > 0 (never exactly 0).
`function NurbsCurvePoint(const Points: PVector3Single; const PointsCount: Cardinal; const U: Single; const Order: Cardinal; Knot, Weight: TDoubleList; Tangent: PVector3Single): TVector3Single;`
Return point on NURBS curve. Requires: PointsCount > 0 (not exactly 0). Order >= 2 (X3D and VRML 97 spec require this too). Knot must have exactly PointsCount + Order items. Weight will be used only if it has the same length as PointsCount. Otherwise, weight = 1.0 (that is, defining non-rational curve) will be used (this follows X3D spec). Tangent, if non-nil, will be set to the direction at given point of the curve, pointing from the smaller to larger knot values. It will be normalized. This can be directly useful to generate orientations by X3D NurbsOrientationInterpolator node.
`function NurbsCurvePoint(const Points: TVector3SingleList; const U: Single; const Order: Cardinal; Knot, Weight: TDoubleList; Tangent: PVector3Single): TVector3Single;`
`function NurbsSurfacePoint(const Points: TVector3SingleList; const UDimension, VDimension: Cardinal; const U, V: Single; const UOrder, VOrder: Cardinal; UKnot, VKnot, Weight: TDoubleList; Normal: PVector3Single): TVector3Single;`
Return point on NURBS surface. Requires: UDimension, VDimension > 0 (not exactly 0). Points.Count must match UDimension * VDimension. Order >= 2 (X3D and VRML 97 spec require this too). Each xKnot must have exactly xDimension + Order items. Weight will be used only if it has the same length as PointsCount. Otherwise, weight = 1.0 (that is, defining non-rational curve) will be used (this follows X3D spec). Normal, if non-nil, will be set to the normal at given point of the surface. It will be normalized. You can use this to pass these normals to rendering. Or to generate normals for X3D NurbsSurfaceInterpolator node.
`procedure NurbsKnotIfNeeded(Knot: TDoubleList; const Dimension, Order: Cardinal; const Kind: TNurbsKnotKind);`
Calculate a default knot, if Knot doesn't already have required number of items. After this, it's guaranteed that Knot.Count is Dimension + Order (just as required by NurbsCurvePoint, NurbsSurfacePoint).
`function NurbsBoundingBox(Point: TVector3SingleList; Weight: TDoubleList): TBox3D;`
`function NurbsBoundingBox(Point: TVector3SingleList; Weight: TSingleList): TBox3D;`
`function NurbsBoundingBox(Point: TVector3SingleList; Weight: TDoubleList; const Transform: TMatrix4Single): TBox3D;`
`function NurbsBoundingBox(Point: TVector3SingleList; Weight: TSingleList; const Transform: TMatrix4Single): TBox3D;`
### Types
`TNurbsKnotKind = (...);`
Type of NURBS knot vector to generate. ###### Values nkPeriodicUniform: All knot values are evenly spaced, all knots are single. This is good for periodic curves. nkEndpointUniform: Starting and ending knots have Order multiplicity, rest is evenly spaced. The curve hits endpoints.
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:10