Exemplo n.º 1
0
        public override void ComputeAABB(out AABB aabb, Transform xf)
        {
            Vec2 lower = xf * Vertices[0];
            Vec2 upper = lower;

            for (int i = 1; i < VertexCount; ++i)
            {
                Vec2 v = xf * Vertices[i];
                lower = Vec2.Min(lower, v);
                upper = Vec2.Max(upper, v);
            }

            Vec2 r = new Vec2(Radius, Radius);

            aabb = new AABB(lower - r,
                            upper + r);
        }
Exemplo n.º 2
0
 /// Combine two AABBs into this one.
 public void Combine(AABB aabb1, AABB aabb2)
 {
     LowerBound = Vec2.Min(aabb1.LowerBound, aabb2.LowerBound);
     UpperBound = Vec2.Min(aabb1.UpperBound, aabb2.UpperBound);
 }