- All Implemented Interfaces:
Volume
min
and
max
.- Author:
- Ole Kniemeyer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Return value fortestParallelogram(javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Matrix3d, javax.vecmath.Vector3d, javax.vecmath.Vector3d)
indicating that this bounding box lies completely above the plane of the quad.static final int
Return value fortestParallelogram(javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Matrix3d, javax.vecmath.Vector3d, javax.vecmath.Vector3d)
indicating that this bounding box lies completely below the plane of the quad.static final int
The maximum coordinates of this box.The minimum coordinates of this box.static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boxContainsBoundary
(BoundingBox box, Tuple3d center, double radius, Variables temp) Returnstrue
if the specifiedbox
contains (part of) the boundary surface of this volume.boolean
computeIntersections
(Line line, int which, IntersectionList list, Intersection excludeStart, Intersection excludeEnd) Computes intersections between the boundary surface of this object and the specifiedline
.static boolean
computeIntersections
(Volume box, Tuple3d min, Tuple3d max, Line line, boolean all, IntersectionList list, int excludeStartFace, int excludeEndFace) Computes the intersections (or the first thereof, ifall
isfalse
) between the faces of the bounding box[min, max]
and the specifiedline
, see also the general methodVolume.computeIntersections(de.grogra.vecmath.geom.Line, int, de.grogra.vecmath.geom.IntersectionList, de.grogra.vecmath.geom.Intersection, de.grogra.vecmath.geom.Intersection)
.void
computeNormal
(Intersection is, Vector3d normal) This method computes the unit normal vector of an intersectionis
which has been computed previously by the invocation ofVolume.computeIntersections(de.grogra.vecmath.geom.Line, int, de.grogra.vecmath.geom.IntersectionList, de.grogra.vecmath.geom.Intersection, de.grogra.vecmath.geom.Intersection)
on this volume.void
computeTangents
(Intersection is, Vector3d dpdu, Vector3d dpdv) This method computes the derivatives of the surface point (as function of the uv-coordinates, seeVolume.computeUV(de.grogra.vecmath.geom.Intersection, javax.vecmath.Vector2d)
) with respect to u and v at the intersection point.void
computeUV
(Intersection is, Vector2d uv) This method computes the uv-coordinates of an intersection pointis
which has been computed previously by the invocation ofVolume.computeIntersections(de.grogra.vecmath.geom.Line, int, de.grogra.vecmath.geom.IntersectionList, de.grogra.vecmath.geom.Intersection, de.grogra.vecmath.geom.Intersection)
on this volume.boolean
Determines if the givenpoint
lies within this object.boolean
void
Computes the extent of this volume, i.e., an axis-aligned bounding box betweenmin
andmax
.int
testParallelogram
(Tuple3d a, Tuple3d b, Tuple3d c, Tuple3d d, Matrix3d inv, Vector3d normal, Vector3d v) Determines if the specified parallelogram intersects this bounding box.toString()
Methods inherited from class de.grogra.vecmath.geom.VolumeBase
addConvexIntersections, getId, operator$and, operator$com, operator$or, operator$sub, setId
-
Field Details
-
min
The minimum coordinates of this box. -
max
The maximum coordinates of this box. -
INTERSECTION
public static final int INTERSECTIONReturn value fortestParallelogram(javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Matrix3d, javax.vecmath.Vector3d, javax.vecmath.Vector3d)
indicating an intersection.- See Also:
-
NO_INTERSECTION
public static final int NO_INTERSECTIONReturn value fortestParallelogram(javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Matrix3d, javax.vecmath.Vector3d, javax.vecmath.Vector3d)
indicating no intersection.- See Also:
-
ABOVE
public static final int ABOVEReturn value fortestParallelogram(javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Matrix3d, javax.vecmath.Vector3d, javax.vecmath.Vector3d)
indicating that this bounding box lies completely above the plane of the quad.- See Also:
-
BELOW
public static final int BELOWReturn value fortestParallelogram(javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Tuple3d, javax.vecmath.Matrix3d, javax.vecmath.Vector3d, javax.vecmath.Vector3d)
indicating that this bounding box lies completely below the plane of the quad.- See Also:
-
-
Constructor Details
-
BoundingBox
-
-
Method Details
-
computeIntersections
public boolean computeIntersections(Line line, int which, IntersectionList list, Intersection excludeStart, Intersection excludeEnd) Description copied from interface:Volume
Computes intersections between the boundary surface of this object and the specifiedline
. The intersections are added tolist
in ascending order of distance (i.e., ofIntersection.parameter
), where theparameter
has to lie betweenline.start
andline.end
. Implementations of this method must not clear or modify the existing intersections inlist
.The parameter
which
has to be one ofIntersection.ALL
,Intersection.CLOSEST
,Intersection.ANY
. It determines if all intersections have to be added to the list, only the closest (minimal value ofIntersection.parameter
), or an arbitrary of the set of all intersections. Only in case ofALL
, the return value of this method is precise.If specific intersection points should be excluded from the list of computed intersections, they have to be specified in
excludeStart
andexcludeEnd
. The intersection point ofexcludeStart
has to be the starting point ofline
, the intersection point ofexcludeEnd
has to be the end point ofline
. The exclusion of intersections is a useful feature for ray-tracing, e.g., when a ray is re-emitted at an intersection point in another direction.- Parameters:
line
- a linewhich
- one ofIntersection.ALL
,Intersection.CLOSEST
,Intersection.ANY
, this determines which intersections have to be added tolist
list
- the intersections are added to this listexcludeStart
- intersection at start point which shall be excluded, ornull
excludeEnd
- intersection at end point which shall be excluded, ornull
- Returns:
true
iff the beginning of the line lies within the volume (i.e., if the line starts within the volume or enters the volume at the starting point); however note that the returned value is valid only ifwhich == Intersection.ALL
-
computeIntersections
public static boolean computeIntersections(Volume box, Tuple3d min, Tuple3d max, Line line, boolean all, IntersectionList list, int excludeStartFace, int excludeEndFace) Computes the intersections (or the first thereof, ifall
isfalse
) between the faces of the bounding box[min, max]
and the specifiedline
, see also the general methodVolume.computeIntersections(de.grogra.vecmath.geom.Line, int, de.grogra.vecmath.geom.IntersectionList, de.grogra.vecmath.geom.Intersection, de.grogra.vecmath.geom.Intersection)
.If
excludeStartFace
is non-negative, it has to specify one of the faces of the box, seeCube.LEFT
. The intersection of the line and the specified face is excluded from the set of computed intersections. In this case the starting point of theline
has to lie on the specified face.If
excludeEndFace
is non-negative, the same treatment as forexcludeStartFace
applies with the requirement, that the end point of theline
has to lie on the specified face.- Parameters:
box
- the boxmin
- minimum coordinates of boxmax
- maximum coordinates of boxline
- a lineall
-true
for all intersections,false
for only the first (closest) intersection has to be added tolist
list
- the intersections are added to this listexcludeStartFace
- face which shall be excluded at start, or-1
excludeEndFace
- face which shall be excluded at end, or-1
- Returns:
true
iff the beginning of the line lies within the box (i.e., if the line starts within the box or enters the box at the starting point)
-
contains
Description copied from interface:Volume
Determines if the givenpoint
lies within this object. Ifopen
istrue
, the interior of the volume is considered (the largest open set contained in the volume, i.e., excluding the boundary), otherwise the closure of the volume.- Parameters:
point
- a point in global world coordinatesopen
- consider open or closed set- Returns:
true
iffpoint
is an element of the set
-
getExtent
Description copied from interface:Volume
Computes the extent of this volume, i.e., an axis-aligned bounding box betweenmin
andmax
.- Parameters:
min
- minimum coordinates of bounding box are placed in heremax
- maximum coordinates of bounding box are placed in heretemp
- has to be provided by the invoker, may be used in implementations
-
boxContainsBoundary
Description copied from interface:Volume
Returnstrue
if the specifiedbox
contains (part of) the boundary surface of this volume. Otherwise, if box and boundary do not overlap, this method should returnfalse
, but may also returntrue
if an exact computation would be too expensive or complicated.Note that a box contains the boundary of a closed set S iff both have a non-empty intersection and the box is not contained in the open set of S.
- Parameters:
box
- bounding boxcenter
- center coordinates of boxradius
- radius of enclosing spheretemp
- has to be provided by the invoker, may be used in implementations- Returns:
true
if box contains (part of) the boundary of this volume
-
computeNormal
Description copied from interface:Volume
This method computes the unit normal vector of an intersectionis
which has been computed previously by the invocation ofVolume.computeIntersections(de.grogra.vecmath.geom.Line, int, de.grogra.vecmath.geom.IntersectionList, de.grogra.vecmath.geom.Intersection, de.grogra.vecmath.geom.Intersection)
on this volume.- Parameters:
is
- a previously computed intersectionnormal
- resulting unit vector is placed in here
-
computeUV
Description copied from interface:Volume
This method computes the uv-coordinates of an intersection pointis
which has been computed previously by the invocation ofVolume.computeIntersections(de.grogra.vecmath.geom.Line, int, de.grogra.vecmath.geom.IntersectionList, de.grogra.vecmath.geom.Intersection, de.grogra.vecmath.geom.Intersection)
on this volume.- Parameters:
is
- a previously computed intersectionuv
- resulting uv-coordinates are placed in here
-
computeTangents
Description copied from interface:Volume
This method computes the derivatives of the surface point (as function of the uv-coordinates, seeVolume.computeUV(de.grogra.vecmath.geom.Intersection, javax.vecmath.Vector2d)
) with respect to u and v at the intersection point.- Parameters:
is
- a previously computed intersectiondpdu
- resulting derivative with respect to udpdv
- resulting derivative with respect to v
-
testParallelogram
public int testParallelogram(Tuple3d a, Tuple3d b, Tuple3d c, Tuple3d d, Matrix3d inv, Vector3d normal, Vector3d v) Determines if the specified parallelogram intersects this bounding box. The parallelogram has to specified by the oriented list(a, b, c, d)
of its corners.- Parameters:
a
- first corner of parallelogramb
- second corner of parallelogramc
- third corner of parallelogramd
- fourth corner of parallelograminv
- this matrix will be used internally by the methodnormal
- this vector will be used internally by the methodv
- this vector will be used internally by the method- Returns:
- one of
INTERSECTION
,NO_INTERSECTION
,ABOVE
,BELOW
-
contains
-
toString
-