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); }
public PosAng(Vec3f position, Angles angles) { this.Position = position; this.Angles = angles; }
public PosAng(Vec3f position, float yaw) : this(position, new Angles(0, yaw, 0)) { }
public PosAng(Vec3f position) : this(position, new Angles(0, 0, 0)) { }
public static bool FindClosest(Vec3f from, IEnumerable <Vec3f> to, out Vec3f output) { return(FindClosest(from, to, out output, out float whatever)); }
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)); }
public bool IsExact(Vec3f other) { return(this.X == other.X && this.Y == other.Y && this.Z == other.Z); }
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))); }
public float GetDistance(Vec3f value) { return((this - value).GetLength()); }
public static float GetYawFromAtVector(Vec3f at) { at = at.Normalise(); return((float)Math.Atan2(-at.X, at.Z)); }
public Vec4f(Vec3f data) : this() { this.set(data); }
public float getDistance(Vec3f value) { return((this - value).Length); }