예제 #1
0
        public bool PointInside(Vector3s pos)
        {
            var p = pos.Xz;
            var a = Vertices[0].Xz;
            var b = Vertices[1].Xz;
            var c = Vertices[2].Xz;

            if (Vector2s.PerpDot(a - p, b - a) < 0)
            {
                return(false);
            }
            if (Vector2s.PerpDot(b - p, c - b) < 0)
            {
                return(false);
            }
            if (Vector2s.PerpDot(c - p, a - c) < 0)
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
 public static void WriteBE(this Stream stream, Vector3s vector)
 {
     stream.WriteBE(vector.X);
     stream.WriteBE(vector.Y);
     stream.WriteBE(vector.Z);
 }
예제 #3
0
 public float HeightAt(Vector3s pos)
 {
     return(-(pos.X * Normal.X + Normal.Z * pos.Z + OriginOffset) / Normal.Y);
 }
예제 #4
0
 public void Recalculate()
 {
     Normal       = Vector3.Normalize(Vector3s.Cross(Vertices[1] - Vertices[0], Vertices[2] - Vertices[1]).ToVector3());
     OriginOffset = -Vector3.Dot(Vertices[0].ToVector3(), Normal);
 }
예제 #5
0
 public Triangle3s(Vector3s a, Vector3s b, Vector3s c)
 {
     Vertices = new Vector3s[] { a, b, c };
 }