public class Triangle extends java.lang.Object implements SubstrateObject
Constructor and Description |
---|
Triangle(double[] vert1,
double[] vert2,
double[] vert3,
double p)
define a triangle from three vertices.
|
Modifier and Type | Method and Description |
---|---|
boolean |
boundingBoxIntersects(double[] pos,
double[] step)
checks if a step will intersect the bounding box for the
object.
|
boolean |
crosses(double[] walkerPos,
double[] step,
double[] normal,
double[] d,
boolean ignore,
double origLength,
double[] intDist,
boolean[] in,
double[] p)
checks intersection of a given step with the triangle.
|
BoundingBox |
getBoundingBox()
returns the oriented bounding box for the object.
|
double |
getDiffusivityAt(double[] pos)
returns the diffusivity at the given location.
|
double[] |
getNormal()
returns the normal of the triangle
|
double |
getPermeability(int i) |
double[] |
getVertex(int i) |
void |
initVectors()
recalculate the normal and the u and v vectors used for
triangle intersection
|
boolean |
inside(double[] pos)
checks if a point is inside or outside the object
|
boolean |
intersectsCubicRegion(double[] bottomLeft,
double[] topRight)
checks if triangle intersects an axis-aligned cubic region
|
static void |
main(java.lang.String[] args) |
void |
setVertex(int i,
double[] v)
reset vertex i with the given vector
|
void |
setVertices(double[][] v)
replaces all vertices with the values given
|
static void |
testBoxIntersection1()
checks intersection between triangle completely contained
in cubic region
|
static void |
testBoxIntersection2()
checks intersection between triangle with two
vertices inside cubic region
|
static void |
testBoxIntersection3()
checks intersection between triangle with one
vertex inside cubic region
|
static void |
testBoxIntersection4()
checks intersection between triangle with no vertices
inside box that does nonetheless intersect the region
|
static void |
testBoxIntersection5()
checks intersection between triangle with no vertices
inside box that does nonetheless intersect the region
|
static void |
testStepIntersection() |
java.lang.String |
toString()
returns the details of the triangle as a string
|
boolean |
triBoxOverlap() |
public Triangle(double[] vert1, double[] vert2, double[] vert3, double p)
vert1
- the first vertex of the trianglevert2
- the second vertex of the trianglevert3
- the third vertex of the trianglepublic void setVertex(int i, double[] v)
i
- which vertex do we set?vert
- new vertexpublic void setVertices(double[][] v)
vert
- 3xD array of new verticespublic void initVectors()
public double[] getVertex(int i)
public double[] getNormal()
public boolean crosses(double[] walkerPos, double[] step, double[] normal, double[] d, boolean ignore, double origLength, double[] intDist, boolean[] in, double[] p)
crosses
in interface SubstrateObject
walkerPos
- start point of walkerstep
- step vectornormal
- space to store traingle normald
- distance of interrsection from planeorigLength
- original length of stepintDist
- arcLength to interactionignore
- should we skip the barrier the walker is currently sitting on?in
- are we initially inside or outside the object?public final BoundingBox getBoundingBox()
SubstrateObject
getBoundingBox
in interface SubstrateObject
public final double getDiffusivityAt(double[] pos)
SubstrateObject
getDiffusivityAt
in interface SubstrateObject
pos
- coords mapped onto substratepublic final boolean inside(double[] pos)
SubstrateObject
inside
in interface SubstrateObject
public final boolean intersectsCubicRegion(double[] bottomLeft, double[] topRight)
intersectsCubicRegion
in interface SubstrateObject
bottomLeft
- lower corner of boxtopRight
- upper corner of boxpublic final double getPermeability(int i)
public final boolean boundingBoxIntersects(double[] pos, double[] step)
SubstrateObject
boundingBoxIntersects
in interface SubstrateObject
public java.lang.String toString()
toString
in class java.lang.Object
public final boolean triBoxOverlap()
public static void testStepIntersection()
public static void testBoxIntersection1()
public static void testBoxIntersection2()
public static void testBoxIntersection3()
public static void testBoxIntersection4()
public static void testBoxIntersection5()
public static void main(java.lang.String[] args)