Aurora.ScriptEngine.AuroraDotNetEngine.APIs.LSL_Api.llGetGeometricCenter C# (CSharp) Метод

llGetGeometricCenter() публичный Метод

public llGetGeometricCenter ( ) : Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3
Результат Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3
        public LSL_Vector llGetGeometricCenter()
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return new LSL_Vector();

            Vector3 MinPos = new Vector3(100000, 100000, 100000);
            Vector3 MaxPos = new Vector3(-100000, -100000, -100000);
            foreach (ISceneChildEntity child in m_host.ParentEntity.ChildrenEntities())
            {
                Vector3 tmp = child.AbsolutePosition;
                if (tmp.X < MinPos.X)
                    MinPos.X = tmp.X;
                if (tmp.Y < MinPos.Y)
                    MinPos.Y = tmp.Y;
                if (tmp.Z < MinPos.Z)
                    MinPos.Z = tmp.Z;

                if (tmp.X > MaxPos.X)
                    MaxPos.X = tmp.X;
                if (tmp.Y > MaxPos.Y)
                    MaxPos.Y = tmp.Y;
                if (tmp.Z > MaxPos.Z)
                    MaxPos.Z = tmp.Z;
            }
            Vector3 GroupAvg = ((MaxPos + MinPos) / 2);
            return new LSL_Vector(GroupAvg.X, GroupAvg.Y, GroupAvg.Z);

            //Just plain wrong!
            //return new LSL_Vector(m_host.GetGeometricCenter().X, m_host.GetGeometricCenter().Y, m_host.GetGeometricCenter().Z);
        }
LSL_Api