예제 #1
0
 public void Contains(BoundingSphere other, out ContainmentType ct)
 {
     if (other == null)
         ct = ContainmentType.Disjoint;
     else
         ct = sbf.Contains(ref other.sSphere);
 }
예제 #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));
        }
예제 #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;
        }
예제 #4
0
 public abstract bool Test(BoundingSphere other);
예제 #5
0
 public override BoundingVolume Merge(BoundingSphere other)
 {
     throw new NotImplementedException();
 }
예제 #6
0
 public ContainmentType Contains(BoundingSphere other)
 {
     return sbf.Contains(ref other.sSphere);
 }
예제 #7
0
 public override bool Test(BoundingSphere other)
 {
     return(IntersectionTests.Test(this, other));
 }
예제 #8
0
파일: Cylinder.cs 프로젝트: ukitake/Stratum
 public override bool Test(BoundingSphere other)
 {
     throw new NotImplementedException();
 }
예제 #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;
        }
예제 #10
0
 public override BoundingVolume Merge(BoundingSphere other)
 {
     return BoundingSphere.Merge(this, other);
 }
예제 #11
0
 public override bool TestMoving(BoundingSphere other, Vector3 v0, Vector3 v1, out float t)
 {
     return DynamicIntersectionTests.Test(this, other, v0, v1, out t);
 }
예제 #12
0
파일: Triangle.cs 프로젝트: ukitake/Stratum
 public override bool Test(BoundingSphere other)
 {
     return Collision.SphereIntersectsTriangle(ref other.sSphere, ref P1, ref P2, ref P3);
 }
예제 #13
0
 public override BoundingVolume Merge(BoundingSphere other)
 {
     var otherB = SharpDX.BoundingBox.FromSphere(other.sSphere);
     return new AxisAlignedBoundingBox(SharpDX.BoundingBox.Merge(this.sbb, otherB));
 }
예제 #14
0
 public static AxisAlignedBoundingBox FromSphere(BoundingSphere sphere)
 {
     return new AxisAlignedBoundingBox(BoundingBox.FromSphere(sphere.sSphere));
 }
예제 #15
0
파일: Plane.cs 프로젝트: ukitake/Stratum
 public override bool Test(BoundingSphere other)
 {
     return splane.Intersects(ref other.sSphere) == PlaneIntersectionType.Intersecting;
 }
예제 #16
0
 public override bool Test(BoundingSphere other)
 {
     return IntersectionTests.Test(this, other);
 }
예제 #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;
 }
예제 #18
0
 public abstract BoundingVolume Merge(BoundingSphere other);
예제 #19
0
 public abstract bool TestMoving(BoundingSphere other, Vector3 v0, Vector3 v1, out float t);
예제 #20
0
 public override bool TestMoving(BoundingSphere other, Vector3 v0, Vector3 v1, out float t)
 {
     throw new NotImplementedException();
 }
예제 #21
0
파일: Ray.cs 프로젝트: ukitake/Stratum
 public override bool Test(BoundingSphere other)
 {
     return sray.Intersects(ref other.sSphere);
 }
예제 #22
0
 public override bool Test(BoundingSphere other)
 {
     return(rp.Intersects(ref other.sSphere) || rn.Intersects(ref other.sSphere));
 }