class Lathe extends Biparam implements java.io.Serializable
|
{
|
|
Lathe()
|
{
|
inPnt = new cVector();
|
name = "Lathe";
|
spline = new Spline();
|
uDivs = 32;
|
vDivs = 16;
|
minUDivs = 3;
|
minVDivs = 1;
|
endcaps = false;
|
retile();
|
recalculate();
|
}
|
|
Object3D deepCopy()
|
{
|
Lathe l = new Lathe();
|
deepCopySelf(l);
|
return l;
|
}
|
|
protected void deepCopyNode(Object3D other)
|
{
|
super.deepCopyNode(other);
|
Lathe l = (Lathe)other;
|
l.spline = (Spline)spline.deepCopy();
|
}
|
|
void generatePOV(StringBuffer buffer)
|
{
|
generateNameComment(buffer);
|
generateIndent(buffer);
|
buffer.append("lathe {\n");
|
spline.generatePOV(buffer);
|
generateTransform(buffer);
|
generateIndent(buffer);
|
buffer.append("}\n");
|
}
|
|
Vertex biparamFunction(double u, double v)
|
{
|
Vertex temp = spline.paramFunction(v);
|
if (u < 0)
|
{
|
temp./*pos.*/x = temp./*pos.*/z = 0;
|
} else
|
{
|
double mat[][] = LA.newMatrix();
|
LA.matYRotate(mat, 6.283185 * u);
|
LA.xformPos(temp/*.pos*/, mat, temp/*.pos*/);
|
}
|
return temp;
|
}
|
|
void createEditWindow(GroupEditor callee, boolean newWindow)
|
{
|
if(newWindow)
|
objectUI = new LatheEditor(this, deepCopy(), callee);
|
else
|
objectUI = new LatheEditor(this, callee);
|
editWindow = objectUI.GetEditor();
|
}
|
|
void getBounds(cVector minima, cVector maxima, boolean xform)
|
{
|
spline.getBounds(minima, maxima, true);
|
maxima.z = maxima.x;
|
minima.z = minima.x = -maxima.x;
|
if (xform)
|
transformBounds(minima, maxima);
|
}
|
|
boolean inside(double x, double y, double z, boolean xform)
|
{
|
if (xform)
|
untransform(x, y, z, inPnt);
|
else
|
LA.setVector(inPnt, x, y, z);
|
double rad = (double)Math.sqrt(inPnt.x * inPnt.x + inPnt.z * inPnt.z);
|
int count = spline.intersectHorizontal(rad, inPnt.y);
|
return count % 2 == 1;
|
}
|
|
Spline spline;
|
protected cVector inPnt;
|
}
|