astex
Class Tmesh

java.lang.Object
  extended by astex.Tmesh
Direct Known Subclasses:
GraphicalObject

public class Tmesh
extends java.lang.Object


Field Summary
 int colorStyle
          Color style.
 Tmesh cylinders
          Cylinder graphical object.
static int CYLINDERS
          Types for style.
 boolean debug
          Debugging on?
static int DOTS
          Types for style.
 Tmesh lines
          Sphere graphical object.
static int LINES
          Types for style.
static int MinMaxScalingMode
          The min,max textureScalingMode.
 java.lang.String name
          The name of the object.
 int np
          The number of points in the object.
 int npalloc
          The number of points allocated for the object.
 int nt
          The number of triangles in the object.
 float[] nx
          The normal vectors of the points.
 float[] ny
          The normal vectors of the points.
 float[] nz
          The normal vectors of the points.
static int ObjectColor
          The color style possibilities.
static int OriginalScalingMode
          The original textureScalingMode.
 Tmesh spheres
          Sphere graphical object.
static int SPHERES
          Types for style.
 int style
          Renderering Style.
 int[] t0
          The indices of the points in the triangles.
 int[] t1
          The indices of the points in the triangles.
 int[] t2
          The indices of the points in the triangles.
 int[] tcolor
          The indices of the points in the triangles.
 int transparency
          The transparency of the object.
static int TriangleColor
          The color style possibilities.
static int TRIANGLES
          Types for style.
 float[] u
          The texture coordinates of the points.
 float umax
          The maximum u texture coord.
 float umin
          The minimum u texture coord.
static int UOffset
           
static int UScale
           
static int UTexture
           
 float[] v
          The texture coordinates of the points.
 int[] vcolor
          The color the points.
static int VertexColor
          The color style possibilities.
 float vmax
          The maximum u texture coord.
 float vmin
          The minimum v texture coord.
static int VOffset
           
static int VScale
           
static int VTexture
           
 float[] x
          The x coordinates of the points.
 float[] y
          The y coordinates of the points.
 float[] z
          The z coordinates of the points.
 
Constructor Summary
Tmesh()
          Create a tmesh object.
 
Method Summary
 void addCylinder(double x1, double y1, double z1, double x2, double y2, double z2, double r, int c1, int c2)
          Add a cylinder to this tmesh.
 void addLine(double x1, double y1, double z1, double x2, double y2, double z2, int c1, int c2)
          Add a line to this mesh.
 int addLine(int i, int j, int c)
          Add a line to the object.
 int addPoint(double[] x, double[] n, double tu, double tv)
          Add a point to the object.
 int addPoint(double xp, double yp, double zp, double xn, double yn, double zn, double tu, double tv)
          Add a point to the object.
 int addPoint(double xp, double yp, double zp, int c)
           
 int addPoint(Point3d x, Point3d n, double tu, double tv)
          Add a point to the object.
 void addSphere(double xx, double yy, double zz, double rr, int cc)
          Add a sphere to this tmesh.
 int addTriangle(int i, int j, int k)
           
 int addTriangle(int i, int j, int k, int color)
           
 void clip(int uv)
          Clip Tmesh to those triangles and points that have visible texture coordinates.
static Tmesh copy(DynamicArray objects)
          Copy the specified objects into a new object.
 double distance(int v0, double[] p)
          Distance between vertex and point.
 double distance(int v0, int v1)
          Distance between two points.
 void empty()
          Empty an object.
 void ensurePointCapacity()
          Make sure we have room for the next point.
 void ensureTriangleCapacity()
          Make sure we have room for the next triangle.
 boolean getBackface()
          Get the value of backface.
 double getBoundingSphere(double[] c)
          Find simple bounding sphere of the tmesh.
 int getColor()
          Get the value of color.
 int getColorStyle()
          Get the object color style.
 double getInverseTexture(int uv, double val)
          Get inverse texture coordinate.
 double getLineWidth()
          Set the linewidth.
 java.lang.String getName()
          Get the value of name.
 int getnPoints()
          Get the number of points.
 Renderer getRenderer()
          Get the MoleculeRenderer value.
 int getRenderPass()
          Get the RenderPass value.
 int getTextureScalingMode()
          Get the texture scaling mode.
 double getUOffset()
          Get the uoffset.
 double getUScale()
          Get the uscale.
 void getVertex(int v, double[] px, double[] nxx)
          Get the vertex info for the specified point.
 double getVOffset()
          Get the voffset.
 double getVScale()
          Get the vscale.
 boolean isVisible()
          Get the value of visible.
static void main(java.lang.String[] args)
          Test program.
 void mid(double[] v, int v0, int v1)
          Find mid point of two vertices.
 void output(java.lang.String filename)
          Prints the tmesh to a file.
static Tmesh read(java.lang.String file)
          Create a tmesh from a file.
static Tmesh readPly(FILE f)
          Read a ply file.
 void recalculateNormals()
          Recalculate normals.
 void render()
          Called when the Tmesh needs to draw itself.
 void setBackface(boolean v)
          Set the value of backface.
 void setClipped(int i, boolean state)
          Set whether this point is clipped.
 void setColor(int v)
          Set the value of color.
 void setColorStyle(int s)
          Set the object color style.
 void setLineWidth(double d)
          Set the linewidth.
 void setMinMax(int uv)
          Set min and max for the specified texture coordinate.
 void setName(java.lang.String v)
          Set the value of name.
 void setPointCapacity(int nn)
          Set the initial capacity for points.
 void setRenderer(Renderer r)
          Set the Renderer value.
 void setRenderPass(int newRenderPass)
          Set the RenderPass value.
 void setTextureRange(int uv, double min, double max)
          Set the texture range.
 void setTextureScalingMode(int sm)
          Set the texture scaling mode.
 void setTransparency(int t)
          Set the transparency.
 void setTriangleCapacity(int nn)
          Set the initial capacity for triangles.
 void setUOffset(double f)
          Set the uoffset.
 void setUScale(double f)
          Set the uscale.
 void setVertex(int v, double[] px, double[] nxx)
          Set the vertex info for the specified point.
 void setVisible(boolean v)
          Set the value of visible.
 void setVOffset(double f)
          Set the voffset.
 void setVScale(double f)
          Set the vscale.
 void smooth(double dlen)
          Smooth the tmesh object.
 java.lang.String toString()
          String representation of object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

np

public int np
The number of points in the object.


npalloc

public int npalloc
The number of points allocated for the object.


x

public float[] x
The x coordinates of the points.


y

public float[] y
The y coordinates of the points.


z

public float[] z
The z coordinates of the points.


nx

public float[] nx
The normal vectors of the points.


ny

public float[] ny
The normal vectors of the points.


nz

public float[] nz
The normal vectors of the points.


u

public float[] u
The texture coordinates of the points.


v

public float[] v
The texture coordinates of the points.


vcolor

public int[] vcolor
The color the points.


transparency

public int transparency
The transparency of the object.


OriginalScalingMode

public static final int OriginalScalingMode
The original textureScalingMode.

See Also:
Constant Field Values

MinMaxScalingMode

public static final int MinMaxScalingMode
The min,max textureScalingMode.

See Also:
Constant Field Values

umin

public float umin
The minimum u texture coord.


umax

public float umax
The maximum u texture coord.


vmin

public float vmin
The minimum v texture coord.


vmax

public float vmax
The maximum u texture coord.


UScale

public static final int UScale
See Also:
Constant Field Values

VScale

public static final int VScale
See Also:
Constant Field Values

UOffset

public static final int UOffset
See Also:
Constant Field Values

VOffset

public static final int VOffset
See Also:
Constant Field Values

UTexture

public static final int UTexture
See Also:
Constant Field Values

VTexture

public static final int VTexture
See Also:
Constant Field Values

spheres

public Tmesh spheres
Sphere graphical object.


cylinders

public Tmesh cylinders
Cylinder graphical object.


lines

public Tmesh lines
Sphere graphical object.


nt

public int nt
The number of triangles in the object.


t0

public int[] t0
The indices of the points in the triangles.


t1

public int[] t1
The indices of the points in the triangles.


t2

public int[] t2
The indices of the points in the triangles.


tcolor

public int[] tcolor
The indices of the points in the triangles.


style

public int style
Renderering Style.


DOTS

public static final int DOTS
Types for style.

See Also:
Constant Field Values

LINES

public static final int LINES
Types for style.

See Also:
Constant Field Values

TRIANGLES

public static final int TRIANGLES
Types for style.

See Also:
Constant Field Values

CYLINDERS

public static final int CYLINDERS
Types for style.

See Also:
Constant Field Values

SPHERES

public static final int SPHERES
Types for style.

See Also:
Constant Field Values

colorStyle

public int colorStyle
Color style.


ObjectColor

public static final int ObjectColor
The color style possibilities.

See Also:
Constant Field Values

TriangleColor

public static final int TriangleColor
The color style possibilities.

See Also:
Constant Field Values

VertexColor

public static final int VertexColor
The color style possibilities.

See Also:
Constant Field Values

debug

public boolean debug
Debugging on?


name

public java.lang.String name
The name of the object.

Constructor Detail

Tmesh

public Tmesh()
Create a tmesh object.

Method Detail

setUScale

public void setUScale(double f)
Set the uscale.


setVScale

public void setVScale(double f)
Set the vscale.


setUOffset

public void setUOffset(double f)
Set the uoffset.


setVOffset

public void setVOffset(double f)
Set the voffset.


getUScale

public double getUScale()
Get the uscale.


getVScale

public double getVScale()
Get the vscale.


getUOffset

public double getUOffset()
Get the uoffset.


getVOffset

public double getVOffset()
Get the voffset.


empty

public void empty()
Empty an object.


getInverseTexture

public double getInverseTexture(int uv,
                                double val)
Get inverse texture coordinate.


setTextureRange

public void setTextureRange(int uv,
                            double min,
                            double max)
Set the texture range.


setMinMax

public void setMinMax(int uv)
Set min and max for the specified texture coordinate.


setColorStyle

public void setColorStyle(int s)
Set the object color style.


getColorStyle

public int getColorStyle()
Get the object color style.


isVisible

public boolean isVisible()
Get the value of visible.

Returns:
value of visible.

setTextureScalingMode

public void setTextureScalingMode(int sm)
Set the texture scaling mode.


getTextureScalingMode

public int getTextureScalingMode()
Get the texture scaling mode.


setVisible

public void setVisible(boolean v)
Set the value of visible.

Parameters:
v - Value to assign to visible.

getBackface

public boolean getBackface()
Get the value of backface.

Returns:
value of backface.

setBackface

public void setBackface(boolean v)
Set the value of backface.

Parameters:
v - Value to assign to backface.

getColor

public int getColor()
Get the value of color.

Returns:
value of color.

setColor

public void setColor(int v)
Set the value of color.

Parameters:
v - Value to assign to color.

getName

public java.lang.String getName()
Get the value of name.

Returns:
value of name.

setTransparency

public void setTransparency(int t)
Set the transparency.


setName

public void setName(java.lang.String v)
Set the value of name.

Parameters:
v - Value to assign to name.

setClipped

public void setClipped(int i,
                       boolean state)
Set whether this point is clipped.


setLineWidth

public void setLineWidth(double d)
Set the linewidth.


getLineWidth

public double getLineWidth()
Set the linewidth.


addPoint

public int addPoint(Point3d x,
                    Point3d n,
                    double tu,
                    double tv)
Add a point to the object.


addPoint

public int addPoint(double[] x,
                    double[] n,
                    double tu,
                    double tv)
Add a point to the object.


addPoint

public int addPoint(double xp,
                    double yp,
                    double zp,
                    double xn,
                    double yn,
                    double zn,
                    double tu,
                    double tv)
Add a point to the object.


addPoint

public int addPoint(double xp,
                    double yp,
                    double zp,
                    int c)

getVertex

public void getVertex(int v,
                      double[] px,
                      double[] nxx)
Get the vertex info for the specified point.


setVertex

public void setVertex(int v,
                      double[] px,
                      double[] nxx)
Set the vertex info for the specified point.


getnPoints

public int getnPoints()
Get the number of points.


setPointCapacity

public void setPointCapacity(int nn)
Set the initial capacity for points.


ensurePointCapacity

public void ensurePointCapacity()
Make sure we have room for the next point.


addLine

public int addLine(int i,
                   int j,
                   int c)
Add a line to the object.


addTriangle

public int addTriangle(int i,
                       int j,
                       int k)

addTriangle

public int addTriangle(int i,
                       int j,
                       int k,
                       int color)

setTriangleCapacity

public void setTriangleCapacity(int nn)
Set the initial capacity for triangles.


ensureTriangleCapacity

public void ensureTriangleCapacity()
Make sure we have room for the next triangle.


addSphere

public void addSphere(double xx,
                      double yy,
                      double zz,
                      double rr,
                      int cc)
Add a sphere to this tmesh.


addLine

public void addLine(double x1,
                    double y1,
                    double z1,
                    double x2,
                    double y2,
                    double z2,
                    int c1,
                    int c2)
Add a line to this mesh.


addCylinder

public void addCylinder(double x1,
                        double y1,
                        double z1,
                        double x2,
                        double y2,
                        double z2,
                        double r,
                        int c1,
                        int c2)
Add a cylinder to this tmesh.


readPly

public static Tmesh readPly(FILE f)
Read a ply file.


read

public static Tmesh read(java.lang.String file)
Create a tmesh from a file.


distance

public double distance(int v0,
                       int v1)
Distance between two points.


distance

public double distance(int v0,
                       double[] p)
Distance between vertex and point.


mid

public void mid(double[] v,
                int v0,
                int v1)
Find mid point of two vertices.


output

public void output(java.lang.String filename)
Prints the tmesh to a file.


getBoundingSphere

public double getBoundingSphere(double[] c)
Find simple bounding sphere of the tmesh.


clip

public void clip(int uv)
Clip Tmesh to those triangles and points that have visible texture coordinates.


recalculateNormals

public void recalculateNormals()
Recalculate normals.


toString

public java.lang.String toString()
String representation of object.

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
Test program.


smooth

public void smooth(double dlen)
Smooth the tmesh object.


copy

public static Tmesh copy(DynamicArray objects)
Copy the specified objects into a new object.


getRenderer

public Renderer getRenderer()
Get the MoleculeRenderer value.


setRenderer

public void setRenderer(Renderer r)
Set the Renderer value.


getRenderPass

public int getRenderPass()
Get the RenderPass value.

Returns:
the RenderPass value.

setRenderPass

public void setRenderPass(int newRenderPass)
Set the RenderPass value.

Parameters:
newRenderPass - The new RenderPass value.

render

public void render()
Called when the Tmesh needs to draw itself. Render states are obtained from the moleculeRenderer which gives a reference to the low lying renderer, and the container which holds moleculeRenderer.