Esempio n. 1
0
        public static bool FindClosest(Vec3f from, IEnumerable <Vec3f> to, out Vec3f output, out float distance)
        {
            Vec3f bestPos  = Vec3f.Null;
            float bestDist = float.MaxValue;

            foreach (var currentPos in to)
            {
                float currentDist = from.GetDistance(currentPos);
                if (currentDist < bestDist)
                {
                    bestPos  = currentPos;
                    bestDist = currentDist;
                }
            }

            distance = bestDist;
            output   = bestPos;
            return(bestDist < float.MaxValue);
        }
Esempio n. 2
0
 public PosAng(Vec3f position, Angles angles)
 {
     this.Position = position;
     this.Angles   = angles;
 }
Esempio n. 3
0
 public PosAng(Vec3f position, float yaw) : this(position, new Angles(0, yaw, 0))
 {
 }
Esempio n. 4
0
 public PosAng(Vec3f position) : this(position, new Angles(0, 0, 0))
 {
 }
Esempio n. 5
0
 public static bool FindClosest(Vec3f from, IEnumerable <Vec3f> to, out Vec3f output)
 {
     return(FindClosest(from, to, out output, out float whatever));
 }
Esempio n. 6
0
 public Vec3f Cross(Vec3f vec)
 {
     return(new Vec3f(this.Y * vec.Z - this.Z * vec.Y,
                      this.Z * vec.X - this.X * vec.Z,
                      this.X * vec.Y - this.Y * vec.X));
 }
Esempio n. 7
0
 public bool IsExact(Vec3f other)
 {
     return(this.X == other.X && this.Y == other.Y && this.Z == other.Z);
 }
Esempio n. 8
0
 public float GetDistancePlanar(Vec3f value)
 {
     return((float)Math.Sqrt((this.X - value.X) * (this.X - value.X) + (this.Z - value.Z) * (this.Z - value.Z)));
 }
Esempio n. 9
0
 public float GetDistance(Vec3f value)
 {
     return((this - value).GetLength());
 }
Esempio n. 10
0
 public static float GetYawFromAtVector(Vec3f at)
 {
     at = at.Normalise();
     return((float)Math.Atan2(-at.X, at.Z));
 }
Esempio n. 11
0
 public Vec4f(Vec3f data)
     : this()
 {
     this.set(data);
 }
Esempio n. 12
0
 public float getDistance(Vec3f value)
 {
     return((this - value).Length);
 }