gov.nist.microanalysis.NISTMonte
Class MultiPlaneShape

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

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

MCSS_MultiPlane implements simple or more complex shapes as the region bounded by a series of planes. The planes are defined by a normal pointing to the outside of the body (imagine a porcupine) and a point on the plane. A point is determined to be inside the MCSS_MultiPlane object if the point is on the inside (the side away from the direction of the surface normal) of each plane.

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

Constructor Summary
MultiPlaneShape()
          MCSS_MultiPlane - Creates a MCSS_MultiPlane object.
 
Method Summary
 void addPlane(double[] normal, double[] point)
          addPlane - Add a new bounding plane to the Shape defined by this MCSS_MultiPlane.
 boolean contains(double[] pos)
          contains - See MonteCarloSS.Shape.contains
static MultiPlaneShape createBlock(double[] dims, double[] point, double phi, double theta, double psi)
          createBlock - Create a block of dimensions specified in dims, centered at point then rotated by the euler angles phi, theta, psi.
static MultiPlaneShape createFilm(double[] normal, double[] pt1, double thickness)
          createFilm - Construct a MCSS_MultiPlane object corresponding to a film.
static MultiPlaneShape createNamid(double[] center, int n, double height, double base)
          Create a Tetrahedron (n=3), Pyramid (n=4), ..., etc with the specified center, number of sides, height and base dimension.
static MultiPlaneShape createSubstrate(double[] normal, double[] pt)
          createSubstrate - Construct a MCSS_MultiPlane object corresponding to an infinitely thick layer.
 double getFirstIntersection(double[] pos0, double[] pos1)
          getFirstIntersection - See MonteCarloSS.Shape.getFirstIntersection
 void render(TrajectoryVRML.RenderContext rc, java.io.Writer wr)
          render - Renders this MultiPlaneShape as a series of triangular facets in a VRML world.
 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.
 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, toString, wait, wait, wait
 

Constructor Detail

MultiPlaneShape

public MultiPlaneShape()
MCSS_MultiPlane - Creates a MCSS_MultiPlane object. Use addPlane to define the Shape.

Method Detail

createFilm

public static MultiPlaneShape createFilm(double[] normal,
                                         double[] pt1,
                                         double thickness)
createFilm - Construct a MCSS_MultiPlane object corresponding to a film. Normal defines the orientation of the plane associated with pt1. A second plane is constructed a distance thickness from the first plane.

Parameters:
normal - double[]
pt1 - double[]
thickness - double
Returns:
MultiPlaneShape

createSubstrate

public static MultiPlaneShape createSubstrate(double[] normal,
                                              double[] pt)
createSubstrate - Construct a MCSS_MultiPlane object corresponding to an infinitely thick layer.

Parameters:
normal - double[]
pt - double[]
Returns:
MultiPlaneShape

createBlock

public static MultiPlaneShape createBlock(double[] dims,
                                          double[] point,
                                          double phi,
                                          double theta,
                                          double psi)
createBlock - Create a block of dimensions specified in dims, centered at point then rotated by the euler angles phi, theta, psi. The rotation is a rotation phi around the z-axis, followed by a rotation theta around the y-axis and finally a rotation psi around the z-axis.

Parameters:
dims - double[] - The unrotated dimensions (x,y,z axis)
point - double[] - The location of the center of the block
phi - double - rotation about the z-axis (radians)
theta - double - rotation about the y-axis (radians)
psi - double - rotation about the x-axis (radians)
Returns:
MCSS_MultiPlaneShape

createNamid

public static MultiPlaneShape createNamid(double[] center,
                                          int n,
                                          double height,
                                          double base)
Create a Tetrahedron (n=3), Pyramid (n=4), ..., etc with the specified center, number of sides, height and base dimension. Use rotate(..) to rotate the object into the desired orientation.

Parameters:
center - Location of center double[3]
n - Number of sides (excluding the base)
height - Height of the object (>0)
base - Length of a side of the base
Returns:
MultiPlaneShape

addPlane

public void addPlane(double[] normal,
                     double[] point)
addPlane - Add a new bounding plane to the Shape defined by this MCSS_MultiPlane.

Parameters:
normal - double[]
point - double[]

contains

public boolean contains(double[] pos)
contains - See MonteCarloSS.Shape.contains

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

getFirstIntersection

public double getFirstIntersection(double[] pos0,
                                   double[] pos1)
getFirstIntersection - See MonteCarloSS.Shape.getFirstIntersection

Specified by:
getFirstIntersection in interface MonteCarloSS.Shape
Parameters:
pos0 - double[]
pos1 - double[]
Returns:
double

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

render

public void render(TrajectoryVRML.RenderContext rc,
                   java.io.Writer wr)
            throws java.io.IOException
render - Renders this MultiPlaneShape as a series of triangular facets in a VRML world. I've tested this against a handful of shapes and it seems to work. The details are a little complex so I wouldn't be surprised if someone found a problem or two.

Specified by:
render in interface TrajectoryVRML.IRender
Parameters:
rc - The context into which to render this object ` *
wr - The Writer into which to write the results (non-Javadoc)
Throws:
java.io.IOException
See Also:
TrajectoryVRML.IRender.render(gov.nist.microanalysis.NISTMonte.TrajectoryVRML.RenderContext, java.io.Writer)