gov.nist.microanalysis.NISTMonte
Class CylindricalShape

java.lang.Object
  extended by gov.nist.microanalysis.NISTMonte.CylindricalShape
All Implemented Interfaces:
ITransform, MonteCarloSS.Shape, TrajectoryVRML.IRender, java.lang.Cloneable

public class CylindricalShape
extends java.lang.Object
implements MonteCarloSS.Shape, ITransform, TrajectoryVRML.IRender, java.lang.Cloneable

A MonteCarloSS.Shape representing a cylindrical shape of arbitrary axis and radius.

Copyright: Pursuant to title 17 Section 105 of the United States Code this software is not subject to copyright protection and is in the public domain

Company: National Institute of Standards and Technology

Version:
1.0
Author:
Nicholas W. M. Ritchie

Field Summary
static java.lang.String CYLINDER_WALL
           
static java.lang.String END_CAP_0
           
static java.lang.String END_CAP_1
           
static java.lang.String NOT_NEAR
           
 
Constructor Summary
CylindricalShape(double[] end0, double[] end1, double radius)
          MCSS_CylindricalShape - Create a cylindrical shape from the end points specified with the specified radius.
 
Method Summary
 java.lang.Object clone(java.lang.Object obj)
           
 boolean contains(double[] pos)
          contains - Is the specified point inside the item represented by this Shape interface? A point on the interface between two Shapes is considered to be inside both Shapes.
 double[] getEnd0()
          getEnd0 - Get one end point of the cylinder axis.
 double[] getEnd1()
          getEnd1 - Get one the other end point of the cylinder axis.
 double getFirstIntersection(double[] parm0, double[] parm1)
          getFirstIntersection - Consider a ray starting at pos0 towards pos1.
 double getLength()
           
 double getRadius()
          getRadius - Returns the radius of the cylinder.
 java.lang.String nearWall(double[] parm0, double[] parm1, double u)
          nearWall - Tests whether the specified u is near one of the walls of the cylinder.
 void render(TrajectoryVRML.RenderContext vra, java.io.Writer wr)
          render - Renders the object.
 void rotate(double[] pivot, double phi, double theta, double psi)
          rotate - Rotate the object around the specified point by phi about the z-axis followed by theta round the y-axis followed by psi around the z-axis.
 java.lang.String toString()
           
 void translate(double[] distance)
          translate - Translate this object by the distance specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_NEAR

public static final java.lang.String NOT_NEAR
See Also:
Constant Field Values

END_CAP_1

public static final java.lang.String END_CAP_1
See Also:
Constant Field Values

END_CAP_0

public static final java.lang.String END_CAP_0
See Also:
Constant Field Values

CYLINDER_WALL

public static final java.lang.String CYLINDER_WALL
See Also:
Constant Field Values
Constructor Detail

CylindricalShape

public CylindricalShape(double[] end0,
                        double[] end1,
                        double radius)
MCSS_CylindricalShape - Create a cylindrical shape from the end points specified with the specified radius.

Parameters:
end0 - double[]
end1 - double[]
radius - double
Method Detail

clone

public java.lang.Object clone(java.lang.Object obj)

contains

public boolean contains(double[] pos)
Description copied from interface: MonteCarloSS.Shape
contains - Is the specified point inside the item represented by this Shape interface? A point on the interface between two Shapes is considered to be inside both Shapes.

Specified by:
contains in interface MonteCarloSS.Shape
Parameters:
pos - double[] - a three item array
Returns:
boolean

getEnd0

public double[] getEnd0()
getEnd0 - Get one end point of the cylinder axis.

Returns:
double[]

getEnd1

public double[] getEnd1()
getEnd1 - Get one the other end point of the cylinder axis.

Returns:
double[]

nearWall

public java.lang.String nearWall(double[] parm0,
                                 double[] parm1,
                                 double u)
nearWall - Tests whether the specified u is near one of the walls of the cylinder.

Parameters:
parm0 - double[]
parm1 - double[]
u - double
Returns:
boolean

getFirstIntersection

public double getFirstIntersection(double[] parm0,
                                   double[] parm1)
Description copied from interface: MonteCarloSS.Shape
getFirstIntersection - Consider a ray starting at pos0 towards pos1. If the ray does not intersect this shape return Double.MAX_VALUE. If the ray does intersect the Shape, return the u such that p(u)=pos0+u*(pos1-pos0) is the point at which the intersection occurs. If u is greater or equal to 0 but less than or equal to 1, the intersection occurs on the interval [pos0,pos1]. This indicates that a full step from pos0 to pos1 will not remain entirely inside Shape. In fact, the longest possible step is between pos0 and p(u). Intersections before pos0 (ie u<0.0) are not relevant and should be ignored. You may optimize getFirstIntersection in the case that u is greater than 1.0. Since the distance between pos0 and pos1 represents a single step and u=1.0 represents taking the full step, you may return a number greater than 1.0 but less than the real u when the real u is greater than one and it would require additional computation to discover the actual value of u.

Specified by:
getFirstIntersection in interface MonteCarloSS.Shape
Parameters:
parm0 - double[] - three element array
parm1 - double[] - three element array
Returns:
double - The fraction of the length from pos0 to pos1 at which the first intersection occurs. Otherwise Double.MAX_VALUE.

rotate

public void rotate(double[] pivot,
                   double phi,
                   double theta,
                   double psi)
Description copied from interface: ITransform
rotate - Rotate the object around the specified point by phi about the z-axis followed by theta round the y-axis followed by psi around the z-axis. These is the standard Euler angle rotation. The rotation matrix is...
[ cos(phi)*cos(th)*cos(psi)-sin(phi)*sin(psi) -sin(phi)*cos(th)*cos(psi)-cos(phi)*sin(psi) sin(th)*cos(psi) ]
[ sin(phi)*cos(psi)+cos(phi)*cos(th)*sin(psi) -sin(phi)*cos(th)*sin(psi)+cos(phi)*cos(psi) sin(th)*sin(psi) ]
[ -cos(phi)*sin(th) sin(th)*sin(phi) cos(th) ]

Specified by:
rotate in interface ITransform
Parameters:
pivot - double[] - a three-vector specifying the point around which the rotation is performed
phi - double
theta - double
psi - double

translate

public void translate(double[] distance)
Description copied from interface: ITransform
translate - Translate this object by the distance specified.

Specified by:
translate in interface ITransform
Parameters:
distance - double[] - A three-vector specifying how much to translate

getRadius

public double getRadius()
getRadius - Returns the radius of the cylinder.

Returns:
double

getLength

public double getLength()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

render

public void render(TrajectoryVRML.RenderContext vra,
                   java.io.Writer wr)
            throws java.io.IOException
Description copied from interface: TrajectoryVRML.IRender
render - Renders the object. Use the scale translation 1.0 micrometer equals 1.0 VRML unit.

Specified by:
render in interface TrajectoryVRML.IRender
Parameters:
vra - The RenderContext object
wr - The Writer into which to output the results
Throws:
java.io.IOException