Nurbs.Crv
index
d:\dev\python21\nurbs\crv.py

 
Modules
            
Numeric
math

 
Classes
            
Crv
Arc
Line
Polyline
UnitCircle
Circle

 
class Arc(Crv)
      NURBS representation of a arc in the xy plan
with given radius (default = 1.) and optional center,
start angle (default = 0) and end angle. (default = 2*pi)
 
  
__call__(self, *args) from Crv
__init__(self, radius=1.0, center=None, sang=0.0, eang=6.2831853071795862)
__repr__(self) from Crv
bezier(self, update=None) from Crv
bounds(self) from Crv
degelev(self, degree) from Crv
kntins(self, uknots) from Crv
plot(self, n=25) from Crv
pnt3D(self, ut) from Crv
pnt4D(self, ut) from Crv
reverse(self) from Crv
trans(self, mat) from Crv

 
class Circle(UnitCircle)
      NURBS representation of a circle in the xy plan
with given radius (default = .5) and optional center.
 
  
__call__(self, *args) from Crv
__init__(self, radius=0.5, center=None)
__repr__(self) from Crv
bezier(self, update=None) from Crv
bounds(self) from Crv
degelev(self, degree) from Crv
kntins(self, uknots) from Crv
plot(self, n=25) from Crv
pnt3D(self, ut) from Crv
pnt4D(self, ut) from Crv
reverse(self) from Crv
trans(self, mat) from Crv

 
class Crv
      Construct a NURB curve and check the format.
   
The NURB curve is represented by a 4 dimensional b-spline.
 
INPUT:
 
   cntrl  - Control points, homogeneous coordinates (wx,wy,wz,w)
           [dim,nu] matrix
           dim is the dimension valid options are:
           2 .... (x,y)        2D cartesian coordinates
           3 .... (x,y,z)      3D cartesian coordinates   
           4 .... (wx,wy,wz,w) 4D homogeneous coordinates
 
   uknots - Knot sequence along the parametric u direction.
 
NOTES:
 
   Its assumed that the input knot sequences span the
   interval [0.0,1.0] and are clamped to the control
   points at the end by a knot multiplicity equal to
   the spline order.
 
  
__call__(self, *args)
__init__(self, cntrl, uknots)
__repr__(self)
bezier(self, update=None)
Decompose curve to bezier segments and return overlaping control points
bounds(self)
Return the boundingbox for the curve
degelev(self, degree)
Degree elevate the curve
kntins(self, uknots)
Insert new knots into the curve
NOTE: No knot multiplicity will be increased beyond the order of the spline
plot(self, n=25)
A simple plotting function for debugging purpose
n = number of subdivisions.
Depends on the dislin plotting library.
pnt3D(self, ut)
Evaluate parametric point[s] and return 3D cartesian coordinate[s]
pnt4D(self, ut)
Evaluate parametric point[s] and return 4D homogeneous coordinates
reverse(self)
Reverse evaluation direction
trans(self, mat)
Apply the 4D transform matrix to the NURB control points.

 
class Line(Crv)
      A straight line segment
Example: c = Line([0,0],[1,1])
 
  
__call__(self, *args) from Crv
__init__(self, p1=(0, 0, 0), p2=(1, 0, 0))
__repr__(self) from Crv
bezier(self, update=None) from Crv
bounds(self) from Crv
degelev(self, degree) from Crv
kntins(self, uknots) from Crv
plot(self, n=25) from Crv
pnt3D(self, ut) from Crv
pnt4D(self, ut) from Crv
reverse(self) from Crv
trans(self, mat) from Crv

 
class Polyline(Crv)
      A polyline
Example: c = Polyline([[0,0],[5,2],[10,8]])
 
  
__call__(self, *args) from Crv
__init__(self, pnts)
__repr__(self) from Crv
bezier(self, update=None) from Crv
bounds(self) from Crv
degelev(self, degree) from Crv
kntins(self, uknots) from Crv
plot(self, n=25) from Crv
pnt3D(self, ut) from Crv
pnt4D(self, ut) from Crv
reverse(self) from Crv
trans(self, mat) from Crv

 
class UnitCircle(Crv)
      NURBS representation of a unit circle in the xy plan
 
  
__call__(self, *args) from Crv
__init__(self)
__repr__(self) from Crv
bezier(self, update=None) from Crv
bounds(self) from Crv
degelev(self, degree) from Crv
kntins(self, uknots) from Crv
plot(self, n=25) from Crv
pnt3D(self, ut) from Crv
pnt4D(self, ut) from Crv
reverse(self) from Crv
trans(self, mat) from Crv

 
Functions
            
bspbezdecom(...)
Decompose a B-Spline to Bezier segments.
 
INPUT:
 
 n,p,U,Pw
 
OUTPUT:
 
 Qw
 
Modified version of Algorithm A5.6 from 'The NURBS BOOK' pg173.
bspdegelev(...)
Degree elevate a B-Spline t times.
 
INPUT:
 
 n,p,U,Pw,t
 
OUTPUT:
 
 nh,Uh,Qw
 
Modified version of Algorithm A5.9 from 'The NURBS BOOK' pg206.
bspeval(...)
Evaluation of univariate B-Spline. 
 
INPUT:
 
 d - spline degree       integer
 c - control points      double  matrix(mc,nc)
 k - knot sequence       double  vector(nk)
 u - parametric points   double  vector(nu)
 
OUTPUT:
 
   p - evaluated points    double  matrix(mc,nu)
 
Modified version of Algorithm A3.1 from 'The NURBS BOOK' pg82.
bspkntins(...)
Insert Knot into a B-Spline.
 
INPUT:
 
 d - spline degree       integer
 c - control points      double  matrix(mc,nc)
 k - knot sequence       double  vector(nk)
 u - new knots           double  vector(nu)
 
OUTPUT:
 
 ic - new control points double  matrix(mc,nc+nu)
 ik - new knot sequence  double  vector(nk+nu)
 
Modified version of Algorithm A5.4 from 'The NURBS BOOK' pg164.

 
Data
             NURBSError = 'NURBSError'
__file__ = r'D:\Dev\Python21\Nurbs\Crv.pyc'
__name__ = 'Nurbs.Crv'
dependencies = 'This module requires:\n\tNumeric Python\n'