Beispiel #1
0
 public void Contains(BoundingSphere other, out ContainmentType ct)
 {
     if (other == null)
         ct = ContainmentType.Disjoint;
     else
         ct = sbf.Contains(ref other.sSphere);
 }
Beispiel #2
0
        public static BoundingSphere Merge(BoundingSphere first, BoundingSphere second)
        {
            if (first == null && second != null)
                return second;
            if (second == null && first != null)
                return first;

            return new BoundingSphere(SharpDX.BoundingSphere.Merge(first.sSphere, second.sSphere));
        }
Beispiel #3
0
        public static bool Test(BoundingSphere s0, BoundingSphere s1, Vector3 v0, Vector3 v1, out float t)
        {
            // expand sphere s1 by the radius of s0
            s1.Radius += s0.Radius;

            // subtract movement of s1 from both s0 and s1, making s1 stationary
            Vector3 v = v0 - v1;

            // can now test directed segment s = s0.Center + v*t, v = (v0 - v1)/||v0 - v1|| against the expanded sphere for intersection
            float vlen = v.Length();
            SharpDX.Ray s = new SharpDX.Ray(s0.Center, v / vlen);
            if (s1.sSphere.Intersects(ref s, out t))
                return t <= vlen;

            return false;
        }
Beispiel #4
0
 public abstract bool Test(BoundingSphere other);
Beispiel #5
0
 public override BoundingVolume Merge(BoundingSphere other)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 public ContainmentType Contains(BoundingSphere other)
 {
     return sbf.Contains(ref other.sSphere);
 }
Beispiel #7
0
 public override bool Test(BoundingSphere other)
 {
     return(IntersectionTests.Test(this, other));
 }
Beispiel #8
0
 public override bool Test(BoundingSphere other)
 {
     throw new NotImplementedException();
 }
Beispiel #9
0
        public static bool Test(BoundingSphere sphere, Vector3 a, Vector3 b, Vector3 c)
        {
            // Find point P on triangle ABC closest to sphere center
            Vector3 p = ClosestPoint.Find(sphere.Center, a, b, c);

            // Sphere and triangle intersect if the (squared) distance from sphere
            // center to point p is less than the (squared) sphere radius
            Vector3 v = p - sphere.Center;
            return Vector3.Dot(v, v) <= sphere.Radius * sphere.Radius;
        }
Beispiel #10
0
 public override BoundingVolume Merge(BoundingSphere other)
 {
     return BoundingSphere.Merge(this, other);
 }
Beispiel #11
0
 public override bool TestMoving(BoundingSphere other, Vector3 v0, Vector3 v1, out float t)
 {
     return DynamicIntersectionTests.Test(this, other, v0, v1, out t);
 }
Beispiel #12
0
 public override bool Test(BoundingSphere other)
 {
     return Collision.SphereIntersectsTriangle(ref other.sSphere, ref P1, ref P2, ref P3);
 }
 public override BoundingVolume Merge(BoundingSphere other)
 {
     var otherB = SharpDX.BoundingBox.FromSphere(other.sSphere);
     return new AxisAlignedBoundingBox(SharpDX.BoundingBox.Merge(this.sbb, otherB));
 }
 public static AxisAlignedBoundingBox FromSphere(BoundingSphere sphere)
 {
     return new AxisAlignedBoundingBox(BoundingBox.FromSphere(sphere.sSphere));
 }
Beispiel #15
0
 public override bool Test(BoundingSphere other)
 {
     return splane.Intersects(ref other.sSphere) == PlaneIntersectionType.Intersecting;
 }
Beispiel #16
0
 public override bool Test(BoundingSphere other)
 {
     return IntersectionTests.Test(this, other);
 }
Beispiel #17
0
 public static bool Test(LineSegment seg, BoundingSphere sphere)
 {
     ContainmentType ct1 = sphere.Contains(seg.Point1);
     ContainmentType ct2 = sphere.Contains(seg.Point2);
     return ct1 != ct2;
 }
Beispiel #18
0
 public abstract BoundingVolume Merge(BoundingSphere other);
Beispiel #19
0
 public abstract bool TestMoving(BoundingSphere other, Vector3 v0, Vector3 v1, out float t);
Beispiel #20
0
 public override bool TestMoving(BoundingSphere other, Vector3 v0, Vector3 v1, out float t)
 {
     throw new NotImplementedException();
 }
Beispiel #21
0
 public override bool Test(BoundingSphere other)
 {
     return sray.Intersects(ref other.sSphere);
 }
Beispiel #22
0
 public override bool Test(BoundingSphere other)
 {
     return(rp.Intersects(ref other.sSphere) || rn.Intersects(ref other.sSphere));
 }