/// <summary> /// Performs a 3-dimensional rotation on the cuboid and returns a new axis-aligned cuboid resulting from this rotation. Not sure it it makes any sense to use this for other rotations than 90 degree intervals. /// </summary> public Cuboidi RotatedCopy(IVec3 vec, Vec3d origin) { return(RotatedCopy(vec.XAsInt, vec.YAsInt, vec.ZAsInt, origin)); }
/// <summary> /// Returns a new cuboid offseted by given position /// </summary> public Cuboidi OffsetCopy(IVec3 vec) { return(OffsetCopy(vec.XAsInt, vec.YAsInt, vec.ZAsInt)); }
/// <summary> /// Grows the cuboid so that it includes the given block /// </summary> public Cuboidi GrowToInclude(IVec3 vec) { GrowToInclude(vec.XAsInt, vec.YAsInt, vec.ZAsInt); return(this); }
/// <summary> /// Returns the shortest distance between given point and any point inside the cuboid /// </summary> public double ShortestDistanceFrom(IVec3 vec) { return(ShortestDistanceFrom(vec.XAsInt, vec.YAsInt, vec.ZAsInt)); }
/// <summary> /// Substractes the given offset to the cuboid /// </summary> public Cuboidi Sub(IVec3 vec) { Sub(vec.XAsInt, vec.YAsInt, vec.ZAsInt); return(this); }
/// <summary> /// Returns if the given point is inside the cuboid /// </summary> public bool ContainsOrTouches(IVec3 vec) { return(ContainsOrTouches(vec.XAsInt, vec.YAsInt, vec.ZAsInt)); }
/// <summary> /// Sets the minimum and maximum values of the cuboid /// </summary> public Cuboidi Set(IVec3 min, IVec3 max) { Set(min.XAsInt, min.YAsInt, min.ZAsInt, max.XAsInt, max.YAsInt, max.ZAsInt); return(this); }
/// <summary> /// Adds the given offset to the cuboid /// </summary> public Cuboidi Translate(IVec3 vec) { Translate(vec.XAsInt, vec.YAsInt, vec.ZAsInt); return(this); }
public static IVec3 Normalized(IVec3 vec) { float dist = GetLength(vec); return(vec.GetNewInstance(vec.X / dist, vec.Y / dist, vec.Z / dist)); }
public static IVec3 Dot(IVec3 left, IVec3 right) { return(left.GetNewInstance(left.X * right.X, left.Y * right.Y, left.Z * right.Z)); }
public static IVec3 Scale(IVec3 vec, IVec3 scalar) { return(vec.GetNewInstance(vec.X * scalar.X, vec.Y * scalar.Y, vec.Z * scalar.Z)); }
public static IVec3 Scale(IVec3 vec, float scalar) { return(vec.GetNewInstance(vec.X * scalar, vec.Y * scalar, vec.Z * scalar)); }
public static float GetLength(IVec3 vec) { return((float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y + vec.Z * vec.Z)); }
public static float GetDistance(IVec3 vec1, IVec3 vec2) { IVec3 dir = Subtract(vec1, vec2); return(GetLength(dir)); }
public static IVec3 Lerp(IVec3 from, IVec3 to, float t) { IVec3 dir = VectorMath.Subtract(to, from); return(VectorMath.Add(from, VectorMath.Scale(dir, t))); }