Esempio n. 1
0
    public bool Intersects(AABBThreeD aabb)
    {
        var obb = new OBBThreeD();

        obb.SetFrom(aabb);
        return(Intersects(obb, 0));
    }
Esempio n. 2
0
    public AABBThreeD MinimalEnclosingAABB()
    {
        AABBThreeD aabb = new AABBThreeD();;

        aabb.SetFrom(this);
        return(aabb);
    }
Esempio n. 3
0
 void SetFrom(AABBThreeD aabb)
 {
     pos     = aabb.center;
     r       = aabb.halfSize;
     axis[0] = new Vector3(1, 0, 0);
     axis[1] = new Vector3(0, 1, 0);
     axis[2] = new Vector3(0, 0, 1);
 }
Esempio n. 4
0
    //错误
    void AABBTransformAsAABB(AABBThreeD aabb, Matrix4x4 m)
    {
        //Vector3 newCenter = m.MulPos(aabb.CenterPoint());
        // center = m.MultiplyPoint(aabb.CenterPoint());
        Vector3 newDir;
        //Vector3 h = aabb.HalfSize();
        //halfSize
        Vector3 h = halfSize;

        //The following is equal to taking the absolute value of the whole matrix m.
        newDir.x      = MathFunc.ABSDOT3(m.GetRow(0), h);
        newDir.y      = MathFunc.ABSDOT3(m.GetRow(1), h);
        newDir.z      = MathFunc.ABSDOT3(m.GetRow(2), h);
        aabb.minPoint = center - newDir;
        aabb.maxPoint = center + newDir;
    }
Esempio n. 5
0
    public bool Intersects(AABBThreeD aabb)
    {
        // If any of the cardinal X,Y,Z axes is a separating axis, then
        // there is no intersection.
        return(minPoint.x < aabb.maxPoint.x &&

               minPoint.y < aabb.maxPoint.y &&

               minPoint.z < aabb.maxPoint.z &&

               aabb.minPoint.x < maxPoint.x &&

               aabb.minPoint.y < maxPoint.y &&

               aabb.minPoint.z < maxPoint.z);
    }
Esempio n. 6
0
 public bool Contains(AABBThreeD aabb)
 {
     return(this.Contains(aabb.minPoint) && this.Contains(aabb.maxPoint));
 }
Esempio n. 7
0
 void Start()
 {
     data = new AABBThreeD();
 }