render
Class Geometry

java.lang.Object
  |
  +--render.Geometry
Direct Known Subclasses:
InteractiveMesh

public class Geometry
extends java.lang.Object

Handles the manipulation, creation, and storage of geometric objects for use in the renderer.

Each Geometry can have children Geometries extending in a tree structure. Each Geometry has its own transform matrix, Material, and a set of vertices and faces that define the object geometry. Note: to add texture to a geometry other than the mesh, add the u,v components to the vertices.


Field Summary
static double[][] Bezier
          Bezier basis matrix.
static double[][] BezierInverse
          Inverse of the bezier basis matrix.
static double[][] BSpline
          B-Spline basis matrix.
static double[][] CatmullRom
          Catmull-Rom basis matrix.
 Geometry[] child
          Stores the children geometries of the current geometry.
 int[][] faces
          Index of the faces that specifies the order and vertices that define individual faces.
 Matrix globalMatrix
          The global transform matrix used to record modifications to the shape's geometry (like superquadric, or adding slight noise imperfections to the surface).
static double[][] Hermite
          Hermite basis matrix.
 Material material
          Stores the shape's material properties.
 Matrix matrix
          The transform matrix of the Geometry (used to keep track of translations, rotations, and scaling transformations).
protected  boolean modified
          Flag set when the shape has been modified.
 java.lang.String name
          Stores the name of the geometry
 double[] noiseOrigin
          Origin of the noise space, default [0, 0, 0].
static int pullMask
          Used to describe which children are to be transformed using the pull function.
static double pullWeight
          Adjusts the influence-wieght of the pull function.
 double[][] refVertices
          A set of vertices used as an original reference when changes are made to the current set of vertices.
 int verticedepth
          if we don't have a texture then we set it as 6, if we have a texture to apply, the depth is 8
 double[][] vertices
          Array of vertices defining the geometric shape.
 
Constructor Summary
Geometry()
          Constructor sets up the local and global transformation matrices.
 
Method Summary
 Geometry add()
          Adds a new child shape to this shape.
 Geometry add(Geometry s)
          Add an existing shape, as a child to this shape.
 void addImprovedNoise(double freq, double ampl)
          Adds noise to each vertex in the geometry and recursively to its children using improvedNoise.
 void addNoise(double freq, double ampl)
          Adds noise to the global transformation matrix.
 void addNoise(Matrix mat, double freq, double ampl)
          Adds noise (with frequency freq and amplitude ampl) to the desired matrix mat.
 Geometry ball(int n)
          Creates a unit sphere with resolution n composed of 6 n by n patches.
 Geometry bezeledCube(double r)
          Creates a bezeled cube with variable bezel of radius r.
 Geometry child(int n)
          Returns the nth child of the geometry .
 boolean computedMeshNormals()
          Returns whether or nor the mesh normals have been computed yet.
 void computeMeshNormals()
          Computes normals for the wireframe mesh.
 void computePolyhedronNormals()
          Computes normals for each vertex of each face of the polyhedron shape.
 void computeSurfaceNormals()
           
 boolean contains(Geometry s)
          Find out whether the argument is a sub-geometry of this geometry object.
 void copyVertex(double[] src, double[] dst)
          Copies the coordinates and normal values of the original vertex to the target vertex.
 double[][] copyVertices(double[][] src)
          Returns a new 2-d array with a copy of vertices passed as the parameter.
 double[][] copyVertices(double[][] src, double[][] dst)
          Copies and returns the contents of vertex array src to dst.
 Geometry cube()
          Sets the current shape geometry to a unit cube.
 Geometry cylinder(int k)
          Creates a k-sided polygon approximation to a cylinder.
 Geometry delete(Geometry s)
          Delete a child of a shape.
 Geometry delete(int n)
          Delete the nth child of a shape.
 Geometry disk(int k)
          Creates a k-sided regular polygon approximation to a circular disk.
 void displaceByImprovedNoise(double freq, double ampl)
          Displaces the shape geometry (each vertex) and its children by noise determined by frequency and amplitude.
 Geometry extrusion(double[][] O, double[][] P)
          Extrudes a path along another path where O defines the path of the cross-section and P defines the path of the wire.
 Geometry gear(int nTeeth)
          Creates a 3D gear with nTeeth number of teeth.
 Geometry gearDisk(int nTeeth)
          Creates a 2D gear disk with an nTeetch number of teeth.
 Geometry gearTube(int k)
          Creates a hollow cylindrical geared tube with k teeth.
 Geometry gearTube(int m, double[][] path)
          Creates a jointed gear-tube with m number of teeth, along the specified path.
 Matrix getMatrix()
          Gets the transformation matrix for this shape.
 int getMeshCols()
          Internal number of mesh columns.
 int getMeshRows()
          Returns the number of rows in the mesh.
 double[] getOffset()
          Get the x,y,z offset from the parent object.
 Geometry getParent()
          Returns the parent geometry object.
 Geometry globe(int m, int n)
          Creates a longitude/latitude partitioned sphere where m and n specify longitude and latitude respectively.
 Geometry globe(int m, int n, double uLo, double uHi, double vLo, double vHi)
          Creates a longitude/latitude partitioned sphere delimited by ranges in the east-west and north-south directions.
 boolean isDoubleSided()
          Returns the double sided status of the shape, true if the object or its material is double-sided, false otherwise.
 Geometry lathe(int m, int n, double[] Z, double[] R)
          Extrudes a curve of varying radius around a circle.
 Geometry latheGen(int m, double[] T, double[] C, boolean round)
          Extrudes a curve of varying radius around a circle of resolution m defined by the the coordinates in T (containing the succesive z coordinates) and C (containing the succesive radii).
static double[][] makeCircle(int n, double radius)
          Creates a regular n-sided polygonal approximation to a circle with given radius.
static void makeCurve(double[] X, double[] Y, double[] T, double[] C)
          Makes a smooth curve
static double[][] makeGear(int nTeeth)
          Creates a geared path (triangular extrusions from a circle) with a given number of teeth.
static double[][] makePath(int n, double[][] key)
          Creates a smooth path composed of n subsegments that passes through the desired key points (uses hermite spline).
 Geometry mesh(int m, int n)
          Creates a new m by n rectangular mesh ( rows by columns ).
 Geometry patch(int m, int n, double[][] basisMatrix, double[] data)
          Creates a bicubic m by n patch
 Geometry pill(int k, double len, double bulge)
          Creates a pill with resolution k, length len, and degree of roundness bulge.
 Geometry pill(int k, double len, double bulge, double taper)
          Creates a tapered pill with resolution k, length len, and degree of roundness bulge and a taper of the southern hemisphere.
 Geometry polygon(double[] X, double[] Y)
          Creates a polygon defined by the X and Y coordinates.
 int pull(Matrix m, double x0, double x1, double x2, double y0, double y1, double y2, double z0, double z1, double z2)
          Deforms a geometric shape according to the beginning, middle, and end parameters in each dimension.
 int pull(Matrix oldRelMatrix, Matrix newRelMatrix, double x0, double x1, double x2, double y0, double y1, double y2, double z0, double z1, double z2)
          Deforms a geometric shape according to the beginning, middle, and end parameters in each dimension.
 void recomputeMeshNormals()
          Forces a recomputation of the mesh normals.
 Geometry setDoubleSided(boolean tf)
          Sets the flag indicating whether the object is double sided.
 Geometry setMaterial(Material m)
          Set the Material for this shape to be Material m.
 void setMatrix(Matrix m)
          Set the transformation matrix for this shape.
 void setOffset(double x, double y, double z)
          Set the x,y,z offset from the parent object.
 void sew(Geometry s, int a, int b)
          Attempts to sew the s geometry to the current shape geometry if the a and b parameters are both nonzero.
 void sew(Geometry s, int a, int b, Matrix m)
          Attempts to sew the s geometry to the current shape geometry if the a and b parameters are both nonzero according to transformation matrix m.
 Geometry subdivide(int I, int J, int m, int n)
          Subdivides one quad (I, J) of a bicubic mesh into a new m by n mesh.
 Geometry superquadric(double p, double h)
          Deforms the current shape geometry in a similar manner to a quadric, but is just controlled by two parameters (p-center side "inflation", h-corner "inflation").
 void superquadric(Matrix mat, double p, double h)
          Deforms the current shape geometry in a similar manner to a quadric, but is just controlled by two parameters (p-center side "inflation", h-corner "inflation").
 Geometry torus(int m, int n, double r)
          Creates a torus with resolution m by n and radius r.
static void transform(double[] src, Matrix m, double[] dst)
           
 Geometry tube(int k)
          Creates a hollow cylindrical tube with resolution k.
 Geometry tube(int m, double taper)
          Creates a tapered tube, where m denotes the number of steps around the circle and taper indicates the additional scaling of the southern end of the tube.
 Geometry wire(int m, double[][] path, double r)
          Extrudes a wire/jointed-tube along the specified keypoints, with radius r, m segments approximating roundness, along the path determined by the key points.
 Geometry wire(int m, int n, double[][] key, double r)
          Extrudes a wire/jointed-tube along the specified keypoints, with radius r, m segments approximating roundness, and n segments approximating the path along the key points.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

material

public Material material
Stores the shape's material properties.


name

public java.lang.String name
Stores the name of the geometry


child

public Geometry[] child
Stores the children geometries of the current geometry.


matrix

public Matrix matrix
The transform matrix of the Geometry (used to keep track of translations, rotations, and scaling transformations).


globalMatrix

public Matrix globalMatrix
The global transform matrix used to record modifications to the shape's geometry (like superquadric, or adding slight noise imperfections to the surface).

See Also:
superquadric(double, double), addNoise(double, double)

faces

public int[][] faces
Index of the faces that specifies the order and vertices that define individual faces. A face normal is orthogonal to the surface created by counterclockwise traversal of the points (right hand curl rule). First index indicates face number and the second indicates vertex indeces.


vertices

public double[][] vertices
Array of vertices defining the geometric shape. First index indicates vertex number, while the second indicates actual coordinate values.


refVertices

public double[][] refVertices
A set of vertices used as an original reference when changes are made to the current set of vertices.


verticedepth

public int verticedepth
if we don't have a texture then we set it as 6, if we have a texture to apply, the depth is 8


modified

protected boolean modified
Flag set when the shape has been modified.


pullWeight

public static double pullWeight
Adjusts the influence-wieght of the pull function.

See Also:
pull(render.Matrix, double, double, double, double, double, double, double, double, double)

pullMask

public static int pullMask
Used to describe which children are to be transformed using the pull function. 0 bits indicate no pull, 1 bits indicate perform pull.

See Also:
pull(render.Matrix, double, double, double, double, double, double, double, double, double)

noiseOrigin

public double[] noiseOrigin
Origin of the noise space, default [0, 0, 0].


Bezier

public static double[][] Bezier
Bezier basis matrix.


BSpline

public static double[][] BSpline
B-Spline basis matrix.


CatmullRom

public static double[][] CatmullRom
Catmull-Rom basis matrix.


Hermite

public static double[][] Hermite
Hermite basis matrix.


BezierInverse

public static double[][] BezierInverse
Inverse of the bezier basis matrix.

Constructor Detail

Geometry

public Geometry()
Constructor sets up the local and global transformation matrices.

Method Detail

getParent

public Geometry getParent()
Returns the parent geometry object.

Returns:
the parent geometry object

contains

public boolean contains(Geometry s)
Find out whether the argument is a sub-geometry of this geometry object.

Parameters:
s - Geometry to be tested
Returns:
true or false

recomputeMeshNormals

public void recomputeMeshNormals()
Forces a recomputation of the mesh normals.


computedMeshNormals

public boolean computedMeshNormals()
Returns whether or nor the mesh normals have been computed yet.


child

public Geometry child(int n)
Returns the nth child of the geometry .

Parameters:
n - the index of the child requested
Returns:
the shape geometry of the child.

setDoubleSided

public Geometry setDoubleSided(boolean tf)
Sets the flag indicating whether the object is double sided. The geometry may still be rendered on both sides if the material is set to be doublesided.

Parameters:
tf - value of the flag
Returns:
the current shape Geometry
See Also:
Material.setDoubleSided(boolean)

isDoubleSided

public boolean isDoubleSided()
Returns the double sided status of the shape, true if the object or its material is double-sided, false otherwise.

Returns:
True if the object or its material is double-sided, false otherwise.

add

public Geometry add()
Adds a new child shape to this shape.


add

public Geometry add(Geometry s)
Add an existing shape, as a child to this shape.

Parameters:
s - shape Geometry to be added
Returns:
s the added shape

delete

public Geometry delete(Geometry s)
Delete a child of a shape.

Parameters:
s - shape to be deleted from list of children
Returns:
the current shape geometry

delete

public Geometry delete(int n)
Delete the nth child of a shape.

Parameters:
n - the index of the child to be deleted
Returns:
the current shape geometry

setMaterial

public Geometry setMaterial(Material m)
Set the Material for this shape to be Material m.

Parameters:
m - the desired Material
Returns:
the current shape geometry

setMatrix

public void setMatrix(Matrix m)
Set the transformation matrix for this shape.

Parameters:
m - the new matrix for the shape

getMatrix

public Matrix getMatrix()
Gets the transformation matrix for this shape.

Returns:
the transformation matrix for the shape

setOffset

public void setOffset(double x,
                      double y,
                      double z)
Set the x,y,z offset from the parent object.

Parameters:
x - x offset
y - y offset
z - z offset

getOffset

public double[] getOffset()
Get the x,y,z offset from the parent object.

Returns:
array of offsets [x, y, z]

copyVertices

public double[][] copyVertices(double[][] src)
Returns a new 2-d array with a copy of vertices passed as the parameter. Each vertex must consist of 6 values (x,y,z coordinates + x,y,z normal). An arbitrary number of vertices is allowed.

Parameters:
src - array of vertices to be duplicated.
Returns:
a new array with a copy of vertices in src

copyVertices

public double[][] copyVertices(double[][] src,
                               double[][] dst)
Copies and returns the contents of vertex array src to dst. Each vertex must consist of 6 values (x,y,z coordinates + x,y,z normal). An arbitrary number of vertices is allowed, as long as src and dst both have the same dimenstions.

Parameters:
src - the original vertex array
dst - the destination to hold a copy of the original vertices
Returns:
dst, the copy of the original vertices

mesh

public Geometry mesh(int m,
                     int n)
Creates a new m by n rectangular mesh ( rows by columns ).

Parameters:
m - number of rows
n - number of columns
Returns:
the current shape geometry

cube

public Geometry cube()
Sets the current shape geometry to a unit cube.

Returns:
the current shape geometry

bezeledCube

public Geometry bezeledCube(double r)
Creates a bezeled cube with variable bezel of radius r.

Parameters:
r - radius of bezel
Returns:
the current shape geometry

polygon

public Geometry polygon(double[] X,
                        double[] Y)
Creates a polygon defined by the X and Y coordinates.

Parameters:
X - array of x coordinates
Y - array of corresponding y coordinates
Returns:
current shape geometry

disk

public Geometry disk(int k)
Creates a k-sided regular polygon approximation to a circular disk.

Parameters:
k - number of sides of the regular polygon
Returns:
current shape geometry

gearDisk

public Geometry gearDisk(int nTeeth)
Creates a 2D gear disk with an nTeetch number of teeth.

Parameters:
nTeeth - number of teeth on the gear
Returns:
the current shape geometry
See Also:
gear(int)

cylinder

public Geometry cylinder(int k)
Creates a k-sided polygon approximation to a cylinder.

Parameters:
k - number of subdivisions per component of the cyliner
Returns:
the shape geometry

gear

public Geometry gear(int nTeeth)
Creates a 3D gear with nTeeth number of teeth.

Parameters:
nTeeth - number of teeth subdivsions
Returns:
the shape geometry
See Also:
gearDisk(int)

pill

public Geometry pill(int k,
                     double len,
                     double bulge)
Creates a pill with resolution k, length len, and degree of roundness bulge.

Parameters:
k - number of subdivisions of regular polygons used in approximating the actual shapes.
len - the proportional length (height) of the cylinder
bulge - the degree of roundess of the edges. 1 = half sphere. 0 = flat surface
Returns:
the shape geometry
See Also:
pill(int k, double len, double bulge, double taper)

pill

public Geometry pill(int k,
                     double len,
                     double bulge,
                     double taper)
Creates a tapered pill with resolution k, length len, and degree of roundness bulge and a taper of the southern hemisphere. Tapering scales the southern hemisphere of the pill.

Parameters:
k - number of subdivisions of regular polygons used in approximating the actual shapes.
len - the proportional length (height) of the cylinder
bulge - the degree of roundess of the edges. 1 = half sphere. 0 = flat surface
taper - additional scaling of the southern hemisphere ( 1 = original size).
Returns:
the shape geometry

ball

public Geometry ball(int n)
Creates a unit sphere with resolution n composed of 6 n by n patches.

Parameters:
n - resolution of the meshes that compose the sphere
Returns:
the shape geometry
See Also:
globe(int, int)

globe

public Geometry globe(int m,
                      int n)
Creates a longitude/latitude partitioned sphere where m and n specify longitude and latitude respectively.

Parameters:
m - number of longitude subdivisions
n - number of latitude subdivisions
Returns:
the shape geometry.
See Also:
ball(int)

globe

public Geometry globe(int m,
                      int n,
                      double uLo,
                      double uHi,
                      double vLo,
                      double vHi)
Creates a longitude/latitude partitioned sphere delimited by ranges in the east-west and north-south directions.

Parameters:
m - number of longitude subdivisions
n - number of latitude subdivisions
uLo - low end of the east-west range [0..1]
uHi - high end of the east-west range [0..1]
vLo - low end of the north-south range [0..1]
vHi - high end of the north-south range [0..1]
Returns:
the shape geometry.

tube

public Geometry tube(int k)
Creates a hollow cylindrical tube with resolution k.

Parameters:
k - number of regular subdivisions approximating the surface
Returns:
the shape geometry
See Also:
tube(int m, double taper)

gearTube

public Geometry gearTube(int k)
Creates a hollow cylindrical geared tube with k teeth.

Parameters:
k - number of teeth
Returns:
the shape geometry

torus

public Geometry torus(int m,
                      int n,
                      double r)
Creates a torus with resolution m by n and radius r.

Parameters:
m - number of latitude subdivisions
n - number of longitude subdivisions
r - radius of the ring
Returns:
the shape geometry

wire

public Geometry wire(int m,
                     int n,
                     double[][] key,
                     double r)
Extrudes a wire/jointed-tube along the specified keypoints, with radius r, m segments approximating roundness, and n segments approximating the path along the key points.

Parameters:
m - number of sides of the regular polygon approximating the circular cross section of the wire
n - number of sections approximating the path along the key points.
key - the list of points defining the path
r - radius of the wire
Returns:
the shape of the geometry

wire

public Geometry wire(int m,
                     double[][] path,
                     double r)
Extrudes a wire/jointed-tube along the specified keypoints, with radius r, m segments approximating roundness, along the path determined by the key points.

Parameters:
m - number of sides of the regular polygon approximating the circular cross section of the wire
path - the list of key points defining the path
r - radius of the wire
Returns:
the shape of the geometry

gearTube

public Geometry gearTube(int m,
                         double[][] path)
Creates a jointed gear-tube with m number of teeth, along the specified path.

Parameters:
m - number of teeth of the gear
path - the set of points defining the key joints of the wire tube.
Returns:
the shape geometry

extrusion

public Geometry extrusion(double[][] O,
                          double[][] P)
Extrudes a path along another path where O defines the path of the cross-section and P defines the path of the wire.

Parameters:
O - a set of vertices and normals defining the cross section
P - a set of vertices and normals defining the path of the wire.
Returns:
the shape geometry

getMeshRows

public int getMeshRows()
Returns the number of rows in the mesh.


getMeshCols

public int getMeshCols()
Internal number of mesh columns.


computePolyhedronNormals

public void computePolyhedronNormals()
Computes normals for each vertex of each face of the polyhedron shape.


computeMeshNormals

public void computeMeshNormals()
Computes normals for the wireframe mesh.


tube

public Geometry tube(int m,
                     double taper)
Creates a tapered tube, where m denotes the number of steps around the circle and taper indicates the additional scaling of the southern end of the tube.

Parameters:
m - the number of steps around the circle ( regular polygonal approximation)
taper - the scale factor of the southern end of the tube.
Returns:
the shape geometry
See Also:
tube(int m)

lathe

public Geometry lathe(int m,
                      int n,
                      double[] Z,
                      double[] R)
Extrudes a curve of varying radius around a circle.

Algorithm:

The path is first expanded out to a smooth curve, so that it is sampled evenly in n steps. The curve preserves local maxima and minima in radius (eg: if a keypoint has a greater radius than both its neighbors, then that point will be a local maximum in the resulting curve).

Then this expanded path is extruded around a circle.

Parameters:
m - the number of steps around the circle
n - the number of steps to sample along the path
Z - keypoints along the curve that contain successive z coordinates
R - keypoints along the curve that contain successive radii
Returns:
the shape geometry

latheGen

public Geometry latheGen(int m,
                         double[] T,
                         double[] C,
                         boolean round)
Extrudes a curve of varying radius around a circle of resolution m defined by the the coordinates in T (containing the succesive z coordinates) and C (containing the succesive radii).

Parameters:
m - number of segments approximating the roundness of the tube
T - keypoints along the curve that contain successive z coordinates
C - keypoints along the curve that contain successive radii
round - // good question. ij
Returns:
the shape geometry
See Also:
lathe(int m, int n, double[] Z, double[] R)

makePath

public static double[][] makePath(int n,
                                  double[][] key)
Creates a smooth path composed of n subsegments that passes through the desired key points (uses hermite spline).

Parameters:
n - number of subdivisions in path
key - a set of points (inluding normals) defining key positions
Returns:
array of n+1 points defining the path

makeGear

public static double[][] makeGear(int nTeeth)
Creates a geared path (triangular extrusions from a circle) with a given number of teeth.

Parameters:
nTeeth - number of teeth subdivisions in the circle
Returns:
the set of vertices (including normals) that define the shape

makeCircle

public static double[][] makeCircle(int n,
                                    double radius)
Creates a regular n-sided polygonal approximation to a circle with given radius.

Parameters:
n - number of sides in the polygon
radius - the radius of the circle
Returns:
the set of vertices defining the polygon. [point number][x, y, z coordinates]

makeCurve

public static void makeCurve(double[] X,
                             double[] Y,
                             double[] T,
                             double[] C)
Makes a smooth curve


superquadric

public Geometry superquadric(double p,
                             double h)
Deforms the current shape geometry in a similar manner to a quadric, but is just controlled by two parameters (p-center side "inflation", h-corner "inflation").

Parameters:
p - controls the amount of scaling of the centers of sides of the quadric ( p >= 0 )
h - controls the amount of scaling of the corners relative to the rest of the shape ( h >= 0 )
Returns:
the shape geometry
See Also:
superquadric(Matrix mat, double p, double h)

superquadric

public void superquadric(Matrix mat,
                         double p,
                         double h)
Deforms the current shape geometry in a similar manner to a quadric, but is just controlled by two parameters (p-center side "inflation", h-corner "inflation").

Parameters:
mat - the transformation matrix basis for the superquadric
p - controls the amount of scaling of the centers of sides of the quadric ( p >= 0 )
h - controls the amount of scaling of the corners relative to the rest of the shape ( h >= 0 )
See Also:
superquadric(double p, double h)

addNoise

public void addNoise(double freq,
                     double ampl)
Adds noise to the global transformation matrix.

Parameters:
freq - the frequency of noise
ampl - the amplitude of noise
See Also:
addNoise(double freq, double ampl)

addNoise

public void addNoise(Matrix mat,
                     double freq,
                     double ampl)
Adds noise (with frequency freq and amplitude ampl) to the desired matrix mat.

Parameters:
mat - matrix to be modified
freq - frequency of noise
ampl - amplitude of noise

displaceByImprovedNoise

public void displaceByImprovedNoise(double freq,
                                    double ampl)
Displaces the shape geometry (each vertex) and its children by noise determined by frequency and amplitude.

Parameters:
freq - frequency of noise
ampl - amplitude of noise
See Also:
addImprovedNoise(double freq, double ampl)

addImprovedNoise

public void addImprovedNoise(double freq,
                             double ampl)
Adds noise to each vertex in the geometry and recursively to its children using improvedNoise.

Parameters:
freq - desired frequency of noise
ampl - desired amplitude of noise
See Also:
displaceByImprovedNoise(double freq, double ampl), ImprovedNoise

sew

public void sew(Geometry s,
                int a,
                int b)
Attempts to sew the s geometry to the current shape geometry if the a and b parameters are both nonzero. // ask ken for details. ij

Parameters:
s - geometry mesh to be sewed
a -
b -
See Also:
sew(Geometry s, int a, int b, Matrix m)

sew

public void sew(Geometry s,
                int a,
                int b,
                Matrix m)
Attempts to sew the s geometry to the current shape geometry if the a and b parameters are both nonzero according to transformation matrix m. // ask ken for details. ij

Parameters:
s - geometry mesh to be sewed
a -
b -
m - matrix that modifies the sewing transformation
See Also:
sew(Geometry s, int a, int b)

copyVertex

public void copyVertex(double[] src,
                       double[] dst)
Copies the coordinates and normal values of the original vertex to the target vertex.

Parameters:
src - original source vertex
dst - target destination vertex

pull

public int pull(Matrix m,
                double x0,
                double x1,
                double x2,
                double y0,
                double y1,
                double y2,
                double z0,
                double z1,
                double z2)
Deforms a geometric shape according to the beginning, middle, and end parameters in each dimension. For each dimesion the three parameters indicate the amount of deformation at each position.

0 - beginning, 1 - middle, 2 - end. To indicate infinity (a constant transformation) set two adjacent parameters to the same value. Setting all three parameters to the same value transforms the shape geometry consistently across the entire axis of the parameters.

Parameters:
m - the object's transformation matrix
x0 - location of beginning of deformation along the x axis
x1 - location of beginning of deformation along the x axis
x2 - location of beginning of deformation along the x axis
y0 - location of beginning of deformation along the y axis
y1 - location of beginning of deformation along the y axis
y2 - location of beginning of deformation along the y axis
z0 - location of beginning of deformation along the z axis
z1 - location of beginning of deformation along the z axis
z2 - location of beginning of deformation along the z axis
Returns:
1 if pull operation was successful, 0 otherwise

pull

public int pull(Matrix oldRelMatrix,
                Matrix newRelMatrix,
                double x0,
                double x1,
                double x2,
                double y0,
                double y1,
                double y2,
                double z0,
                double z1,
                double z2)
Deforms a geometric shape according to the beginning, middle, and end parameters in each dimension. For each dimesion the three parameters indicate the amount of deformation at each position.

0 - beginning, 1 - middle, 2 - end. To indicate infinity (a constant transformation) set two adjacent parameters to the same value. Setting all three parameters to the same value transforms the shape geometry consistently across the entire axis of the parameters.

Parameters:
oldRelMatrix - the object's initial transformation (usually the identity matrix)
newRelMatrix - the object's final transformation matrix
x0 - location of beginning of deformation along the x axis
x1 - location of beginning of deformation along the x axis
x2 - location of beginning of deformation along the x axis
y0 - location of beginning of deformation along the y axis
y1 - location of beginning of deformation along the y axis
y2 - location of beginning of deformation along the y axis
z0 - location of beginning of deformation along the z axis
z1 - location of beginning of deformation along the z axis
z2 - location of beginning of deformation along the z axis
Returns:
1 if pull operation was successful, 0 otherwise

transform

public static void transform(double[] src,
                             Matrix m,
                             double[] dst)

subdivide

public Geometry subdivide(int I,
                          int J,
                          int m,
                          int n)
Subdivides one quad (I, J) of a bicubic mesh into a new m by n mesh.

Parameters:
I - row index of quad
J - column index of quad
m - number of rows of new patch
n - number of columns of the new patch
Returns:
the shape geometry

patch

public Geometry patch(int m,
                      int n,
                      double[][] basisMatrix,
                      double[] data)
Creates a bicubic m by n patch

Parameters:
m - number of rows of the patch
n - number of columns in the patch
basisMatrix -
data -
Returns:
the shape geometry

computeSurfaceNormals

public void computeSurfaceNormals()