示例#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
 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
 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));
 }