gov.nist.microanalysis.NISTMonte
Interface MonteCarloSS.Shape

All Known Implementing Classes:
CylindricalShape, MultiPlaneShape, ShapeDifference, SimpleBlock, Sphere, SumShape
Enclosing class:
MonteCarloSS

public static interface MonteCarloSS.Shape

An interface defining sufficient a sufficiently rich set of methods to implement a three dimensional volume. A Region is defined by a Shape and a Material and fully contained child Region objects.


Method Summary
 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 getFirstIntersection(double[] pos0, double[] pos1)
          getFirstIntersection - Consider a ray starting at pos0 towards pos1.
 

Method Detail

contains

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.

Parameters:
pos - double[] - a three item array
Returns:
boolean

getFirstIntersection

double getFirstIntersection(double[] pos0,
                            double[] pos1)
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.

Parameters:
pos0 - double[] - three element array
pos1 - 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.