gov.nist.microanalysis.NISTMonte
Class SimpleBlock

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

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

Implements the MonteCarloSS.Shape interface for a simple block shaped region. The edges of the block are aligned with the coordinate axes. The extent of the block is defined by two corners.

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
SimpleBlock(double[] corner0, double[] corner1)
          SimpleBlock - Constructs a SimpleBlock, simple shape definition class that implements the Shape interface.
 
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.
 void render(TrajectoryVRML.RenderContext rc, java.io.Writer wr)
          render - Renders a SimpleBlock as VRML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBlock

public SimpleBlock(double[] corner0,
                   double[] corner1)
SimpleBlock - Constructs a SimpleBlock, simple shape definition class that implements the Shape interface.

Parameters:
corner0 - double[] - The x,y & z coordinates of one corner
corner1 - double[] - The coordinates of the diagonal corner
Method Detail

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

getFirstIntersection

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

render

public void render(TrajectoryVRML.RenderContext rc,
                   java.io.Writer wr)
            throws java.io.IOException
render - Renders a SimpleBlock as VRML

Specified by:
render in interface TrajectoryVRML.IRender
Parameters:
rc -
wr -
Throws:
java.io.IOException - (non-Javadoc)
See Also:
TrajectoryVRML.IRender.render(gov.nist.microanalysis.NISTMonte.TrajectoryVRML.RenderContext, java.io.Writer)