public class BasicCylinder extends java.lang.Object implements Cylinder, SubstrateObject
Modifier and Type | Field and Description |
---|---|
Point3D |
P
position vector
|
double[] |
Parr
pos as point
|
double[] |
ProtArr
pos as point
|
Constructor and Description |
---|
BasicCylinder(double[] P,
double[] V,
double r,
double p)
constructor that specifies orientation.
|
BasicCylinder(double[] P,
double r,
double p)
constructor without specifying direction.
|
Modifier and Type | Method and Description |
---|---|
boolean |
boundingBoxIntersects(double[] subsCoords,
double[] step)
checks if bounding box is intersected by a step
|
boolean |
crosses(double[] rawPos,
double[] rawStep,
double[] normal,
double[] d,
boolean skipCurrent,
double origLength,
double[] intDist,
boolean[] in,
double[] p)
checks if step will intersect the cylinder.
|
double[] |
getAxis()
returns the axis vector of the cylinder
|
BoundingBox |
getBoundingBox()
returns the oriented bounding box for the object.
|
double |
getDiffusivityAt(double[] subsCoords)
returns the diffusivity at the given location.
|
double |
getDistanceFrom(double[] Q)
calculates the distance d of a given point from the central
axis of the cylinder using the formula
d = sqrt( (Q-P)^2 - [(Q-P).V]^2)
|
double[] |
getPosition()
returns the position vector for the cylinder.
|
double |
getRadius()
returns the radius of the cylinder
|
boolean |
inside(double[] Q)
decides whether a point Q is inside the cylinder or not by comparing
the shortest disance of the point to the central axis to the radius of
the cylinder
|
boolean |
intersectsCubicRegion(double[] bottomLeft,
double[] topRight)
checks if cylinder intersects a specified axis-aligned cubic region.
|
static void |
main(java.lang.String[] args)
entrypoint.
|
static void |
testAnnoyingCase() |
static void |
testArbOrientation() |
void |
toFile(java.io.Writer writer)
spits out cylinder cross section to a file
|
public final Point3D P
public final double[] Parr
public final double[] ProtArr
public BasicCylinder(double[] P, double r, double p)
P
- position of cylinderr
- radius of cylinderp
- permeability of cylinderpublic BasicCylinder(double[] P, double[] V, double r, double p)
P
- position of cylinderV
- orientation of cylinder axisr
- radius of cylinderp
- permeability of cylinderpublic boolean crosses(double[] rawPos, double[] rawStep, double[] normal, double[] d, boolean skipCurrent, double origLength, double[] intDist, boolean[] in, double[] p)
crosses
in interface SubstrateObject
rawPos
- position of walkerrawStep
- step vectornormal
- space to store intersection normald
- space to stor distance from origin in normal directionorigLength
- the length of the original stepintDist
- space to store arclength to intersection pointin
- space to store if walker was initially in or out of cylinderp
- space to store permeability fo cylinder if intersectionskipCurrent
- should we skip the barrier the walker is currently sitting on?public double getDistanceFrom(double[] Q)
getDistanceFrom
in interface Cylinder
Q
- position vector or pointpublic boolean inside(double[] Q)
inside
in interface SubstrateObject
Q
- the point to testpublic double getDiffusivityAt(double[] subsCoords)
SubstrateObject
getDiffusivityAt
in interface SubstrateObject
subsCoords
- coords mapped onto substratepublic BoundingBox getBoundingBox()
SubstrateObject
getBoundingBox
in interface SubstrateObject
public boolean boundingBoxIntersects(double[] subsCoords, double[] step)
boundingBoxIntersects
in interface SubstrateObject
subsCoords
- position mapped onto substratestep
- step vectorpublic final boolean intersectsCubicRegion(double[] bottomLeft, double[] topRight)
intersectsCubicRegion
in interface SubstrateObject
bottomLeft
- coords of bottom-left corner of cubic regiontopRight
- coords of top-right corner of cubic regionpublic double[] getPosition()
getPosition
in interface Cylinder
public double[] getAxis()
public double getRadius()
public void toFile(java.io.Writer writer) throws java.io.IOException
Cylinder
public static final void testArbOrientation()
public static final void testAnnoyingCase()
public static void main(java.lang.String[] args)
args
-