コード例 #1
0
        public static List <Vector3> CalcEqTriangle3DPoints(Vector3 centroid, float sideLength, Quaternion rotation)
        {
            float   halfSideLength   = sideLength * 0.5f;
            float   centroidAltitude = TriangleMath.GetEqTriangleCentroidAltitude(sideLength);
            Vector3 midLeftRight     = centroid - rotation * Vector3.up * centroidAltitude;

            return(new List <Vector3>()
            {
                midLeftRight - rotation * Vector3.right * halfSideLength,
                centroid + rotation * Vector3.up * (TriangleMath.GetEqTriangleAltitude(sideLength) - centroidAltitude),
                midLeftRight + rotation * Vector3.right * halfSideLength
            });
        }
コード例 #2
0
        public static List <Vector2> CalcEqTriangle2DPoints(Vector2 centroid, float sideLength, Quaternion rotation)
        {
            float halfSideLength   = sideLength * 0.5f;
            float centroidAltitude = TriangleMath.GetEqTriangleCentroidAltitude(sideLength);

            Vector2 triangleRight = rotation * Vector2.right;
            Vector2 triangleUp    = rotation * Vector2.up;
            Vector2 midLeftRight  = centroid - triangleUp * centroidAltitude;

            return(new List <Vector2>()
            {
                midLeftRight - triangleRight * halfSideLength,
                centroid + triangleUp * (TriangleMath.GetEqTriangleAltitude(sideLength) - centroidAltitude),
                midLeftRight + triangleRight * halfSideLength,
            });
        }