public final class Sphere extends java.lang.Object implements IVolume<Sphere>
| Modifier and Type | Method and Description |
|---|---|
Sphere |
addScale(Sphere current,
Sphere next,
float t) |
Sphere |
clone() |
Sphere |
concatenate(Sphere other)
Concatenate this volume with other in a new
IVolume object |
float |
distanceToPlane(Plane plane,
boolean min) |
static Sphere |
empty() |
Vec3 |
getCenter() |
Vec3 |
getCenter(Vec3 dst) |
float |
getRadius() |
float |
getVolume() |
boolean |
insideFrustum(Frustum frustum) |
Sphere |
interpolate(Sphere current,
Sphere next,
float t)
Interpolate
this bounding sphere with s
and return the new interpolated bounding sphere. |
Vec3[] |
intersection(Line line)
Line-Sphere Intersection
|
Circle |
intersection(Sphere sphere)
Sphere-Sphere Intersection
System of 5 equations but 4 unknown: (x-x0)²+(y-y0)²+(z-z0)²=R² (x-x1)²+(y-y1)²+(z-z1)²=r² x = x0 + k * x1-x0 y = y0 y1-y0 z = z0 z1-z0 which can be written as : x(x1-x0) + y(y1-y0) + z(z1-z0) = (R²-r² + x1²-x0² + y1²-y0² + z1²-z0²) / 2 x/(x1-x0) + y/(y1-y0 = x0/(x1-x0) - y0/(y1-y0) Reference to find to radius formula: Weisstein, Eric W. |
IntersectTest |
intersectTest(Frustum frustum)
Test the intersection between this
IBoundingVolume and the specified Frustum. |
IntersectTest |
intersectTest(Sphere s) |
Vec3 |
limitInVolume(Vec3 dst,
Vec3 src)
Limit a point location in this volume.
|
static Sphere |
max() |
Sphere |
set(Sphere s) |
Sphere |
set(Vec3 center,
float radius) |
void |
setCenter(Vec3 src) |
void |
setRadius(float radius) |
Sphere |
subtract(Sphere bv1,
Sphere bv2) |
java.lang.String |
toString() |
Sphere |
transform(Sphere bs,
Mat4x4 matrix) |
public Sphere(Vec3 center, float radius)
public static Sphere empty()
public static Sphere max()
public final java.lang.String toString()
toString in class java.lang.Objectpublic final Sphere clone()
public final Sphere set(Sphere s)
set in interface IValueCopy<Sphere>public final float getVolume()
public final Sphere concatenate(Sphere other)
IVolumeIVolume objectconcatenate in interface IVolume<Sphere>other - a IBoundingVolumeVolumes.concatenate(IVolume, IVolume)public final Vec3 limitInVolume(Vec3 dst, Vec3 src)
limitInVolume in interface IVolume<Sphere>src - source pointdst - destination vector to store the resultpublic IntersectTest intersectTest(Sphere s)
intersectTest in interface IVolume<Sphere>s - another volumepublic final Sphere interpolate(Sphere current, Sphere next, float t)
this bounding sphere with s
and return the new interpolated bounding sphere.interpolate in interface IInterpolable<Sphere>interpolate in interface IData<Sphere>interpolate in interface IVolume<Sphere>current - next - t - value in the range [0.; 1.]public final boolean insideFrustum(Frustum frustum)
insideFrustum in interface IVolume<Sphere>public final IntersectTest intersectTest(Frustum frustum)
IVolumeIBoundingVolume and the specified Frustum.intersectTest in interface IVolume<Sphere>VolumeIntersection.Intersect if inside and intersect.VolumeIntersection.Inside if inside but not intersect.VolumeIntersection.Outisde if outside.IntersectTest,
IVolume.insideFrustum(Frustum)public final float distanceToPlane(Plane plane, boolean min)
distanceToPlane in interface IVolume<Sphere>plane - a Planemin - true: minimum distancepublic final Circle intersection(Sphere sphere)
sphere - public final Vec3[] intersection(Line line)
line - public final Vec3 getCenter()
public final void setCenter(Vec3 src)
public final float getRadius()
public final void setRadius(float radius)
Bonzai Engine 1.3.4 11/12/2015 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2015 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com