Make your own free website on Tripod.com
 
 
Nurbs.Srf
index
d:\dev\python21\nurbs\srf.py

 
Modules
            
Nurbs.Crv
Numeric
math

 
Classes
            
Srf
Bilinear
Coons
Extrude
Revolve
Ruled

 
class Bilinear(Srf)
      Constructs a NURB surface defined by 4 points to form a bilinear surface.
Inputs:
    p11 - 3D coordinate of the corner point
    p12 - 3D coordinate of the corner point 
    p21 - 3D coordinate of the corner point 
    p22 - 3D coordinate of the corner point 
 
The position of the corner points
 
    ^ v direction
    |
    ----------------
    |p21        p22|
    |              |
    |    SRF       |
    |              |
    |p11        p12|
    -------------------> u direction
 
  
__call__(self, *args) from Srf
__init__(self, p00=[-0.5, -0.5], p01=[0.5, -0.5], p10=[-0.5, 0.5], p11=[0.5, 0.5])
__repr__(self) from Srf
bezier(self, update=None) from Srf
bounds(self) from Srf
degelev(self, utimes, vtimes=None) from Srf
extractU(self, v) from Srf
extractV(self, u) from Srf
kntins(self, uknots, vknots=None) from Srf
plot(self, n=50, iso=8) from Srf
pnt3D(self, ut, vt=None) from Srf
pnt4D(self, ut, vt=None) from Srf
reverse(self) from Srf
swapuv(self) from Srf
trans(self, mat) from Srf

 
class Coons(Srf)
      Construction of a bilinearly blended Coons patch.
INPUTS:
    u1, u2, v1 ,v2 - four NURBS curves defining boundaries.
NOTES:
    The orientation of the four NURBS boundary curves.
 
     ^ v direction
     |
     |     u2
     ------->--------
     |              |
     |              |
  v1 ^   Surface    ^ v2
     |              |
     |              |
     ------->-----------> u direction
           u1
 
  
__call__(self, *args) from Srf
__init__(self, u1, u2, v1, v2)
__repr__(self) from Srf
bezier(self, update=None) from Srf
bounds(self) from Srf
degelev(self, utimes, vtimes=None) from Srf
extractU(self, v) from Srf
extractV(self, u) from Srf
kntins(self, uknots, vknots=None) from Srf
plot(self, n=50, iso=8) from Srf
pnt3D(self, ut, vt=None) from Srf
pnt4D(self, ut, vt=None) from Srf
reverse(self) from Srf
swapuv(self) from Srf
trans(self, mat) from Srf

 
class Extrude(Srf)
      Construct a NURBS surface by extruding a NURBS curve along the vector (dx,dy,dz).
INPUT:
    curve   - NURBS curve to be extruded.
    vector  - Extrusion vector.
 
  
__call__(self, *args) from Srf
__init__(self, crv, vector)
__repr__(self) from Srf
bezier(self, update=None) from Srf
bounds(self) from Srf
degelev(self, utimes, vtimes=None) from Srf
extractU(self, v) from Srf
extractV(self, u) from Srf
kntins(self, uknots, vknots=None) from Srf
plot(self, n=50, iso=8) from Srf
pnt3D(self, ut, vt=None) from Srf
pnt4D(self, ut, vt=None) from Srf
reverse(self) from Srf
swapuv(self) from Srf
trans(self, mat) from Srf

 
class Revolve(Srf)
      Construct a surface by revolving the profile curve
around an axis defined by a point and a unit vector.
 
srf = nrbrevolve(curve,point,vector[,theta])
 
INPUT:
 
crv    - NURB profile curve.
pnt    - coordinate of the point. (default: [0, 0, 0])
vector - rotation axis. (default: [1, 0, 0])
theta  - angle to revolve curve (default: 2*pi).
 
  
__call__(self, *args) from Srf
__init__(self, crv, pnt=[0.0, 0.0, 0.0], vector=[1.0, 0.0, 0.0], theta=6.2831853071795862)
__repr__(self) from Srf
bezier(self, update=None) from Srf
bounds(self) from Srf
degelev(self, utimes, vtimes=None) from Srf
extractU(self, v) from Srf
extractV(self, u) from Srf
kntins(self, uknots, vknots=None) from Srf
plot(self, n=50, iso=8) from Srf
pnt3D(self, ut, vt=None) from Srf
pnt4D(self, ut, vt=None) from Srf
reverse(self) from Srf
swapuv(self) from Srf
trans(self, mat) from Srf

 
class Ruled(Srf)
      Constructs a ruled surface between two NURBS curves.
INPUT:
    crv1 - first  NURBS curve
    crv2 - second NURBS curve
NOTE:
The ruled surface is ruled along the V direction.
 
  
__call__(self, *args) from Srf
__init__(self, crv1, crv2)
__repr__(self) from Srf
bezier(self, update=None) from Srf
bounds(self) from Srf
degelev(self, utimes, vtimes=None) from Srf
extractU(self, v) from Srf
extractV(self, u) from Srf
kntins(self, uknots, vknots=None) from Srf
plot(self, n=50, iso=8) from Srf
pnt3D(self, ut, vt=None) from Srf
pnt4D(self, ut, vt=None) from Srf
reverse(self) from Srf
swapuv(self) from Srf
trans(self, mat) from Srf

 
class Srf
      Construct a NURB surface structure, and check the format.
   
The NURB surface is represented by a 4 dimensional b-spline.
 
INPUT:
 
   cntrl  - Control points, homogeneous coordinates (wx,wy,wz,w)
       For a surface [dim,nu,nv] matrix
           where nu  is along the u direction and
           nv  is along the v direction.
           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.
   vknots - Knot sequence along the paramteric v 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, vknots)
__repr__(self)
bezier(self, update=None)
Decompose surface to bezier patches and return overlaping control points.
bounds(self)
Return the bounding box for the surface.
degelev(self, utimes, vtimes=None)
Degree elevate the surface.
utimes - degree elevate utimes along u direction.
vtimes - degree elevate vtimes along v direction.
extractU(self, v)
Extract curve in u-direction at parameter v.
extractV(self, u)
Extract curve in v-direction at parameter u.
kntins(self, uknots, vknots=None)
Insert new knots into the surface
uknots - knots to be inserted along u direction
vknots - knots to be inserted along v direction
NOTE: No knot multiplicity will be increased beyond the order of the spline
plot(self, n=50, iso=8)
A simple plotting function based on dislin for debugging purpose.
n = number of subdivisions. iso = number of iso line to plot in each dir.
TODO: plot ctrl poins and knots.
pnt3D(self, ut, vt=None)
Evaluate parametric point[s] and return 3D cartesian coordinate[s]
If only ut is given then we will evaluate at scattered points.
ut(0,:) represents the u direction.
ut(1,:) represents the v direction.
If both parameters are given then we will evaluate over a [u,v] grid.
pnt4D(self, ut, vt=None)
Evaluate parametric point[s] and return 4D homogeneous coordinates.
If only ut is given then we will evaluate at scattered points.
ut(0,:) represents the u direction.
ut(1,:) represents the v direction.
If both parameters are given then we will evaluate over a [u,v] grid.
reverse(self)
Reverse evaluation directions.
swapuv(self)
Swap u and v parameters.
trans(self, mat)
Apply the 4D transform matrix to the NURB control points.

 
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\Srf.pyc'
__name__ = 'Nurbs.Srf'
dependencies = 'This module requires:\n\tNumeric Python\n'