コード例 #1
0
        public static AxisAlignedBox3f Bounds <T>(IEnumerable <T> values, Func <T, Vector3F> PositionF)
        {
            AxisAlignedBox3f box = AxisAlignedBox3f.Empty;

            foreach (T t in values)
            {
                box.Contain(PositionF(t));
            }
            return(box);
        }
コード例 #2
0
        public AxisAlignedBox3f ToAABB()
        {
            // [TODO] probably more efficient way to do this...at minimum can move center-shift
            // to after the containments...
            Vector3F         extAxis0 = Extent.x * AxisX;
            Vector3F         extAxis1 = Extent.y * AxisY;
            Vector3F         extAxis2 = Extent.z * AxisZ;
            AxisAlignedBox3f result   = new AxisAlignedBox3f(Center - extAxis0 - extAxis1 - extAxis2);

            result.Contain(Center + extAxis0 - extAxis1 - extAxis2);
            result.Contain(Center + extAxis0 + extAxis1 - extAxis2);
            result.Contain(Center - extAxis0 + extAxis1 - extAxis2);
            result.Contain(Center - extAxis0 - extAxis1 + extAxis2);
            result.Contain(Center + extAxis0 - extAxis1 + extAxis2);
            result.Contain(Center + extAxis0 + extAxis1 + extAxis2);
            result.Contain(Center - extAxis0 + extAxis1 + extAxis2);
            return(result);
        }