Class Cuboidd
- Namespace
- Vintagestory.API.MathTools
- Assembly
- VintagestoryAPI.dll
Represents a three dimensional axis-aligned cuboid using two 3d coordinates. Used for collision and selection withes.
public class Cuboidd : IEquatable<Cuboidd>
- Inheritance
-
Cuboidd
- Implements
- Inherited Members
- Extension Methods
Constructors
Cuboidd()
public Cuboidd()
Cuboidd(double, double, double, double, double, double)
public Cuboidd(double x1, double y1, double z1, double x2, double y2, double z2)
Parameters
Cuboidd(Vec3d, Vec3d)
public Cuboidd(Vec3d start, Vec3d end)
Parameters
Fields
X1
public double X1
Field Value
X2
public double X2
Field Value
Y1
public double Y1
Field Value
Y2
public double Y2
Field Value
Z1
public double Z1
Field Value
Z2
public double Z2
Field Value
Properties
End
public Vec3d End { get; }
Property Value
Height
MaxY-MinY
public double Height { get; }
Property Value
Length
MaxZ-MinZ
public double Length { get; }
Property Value
MaxX
public double MaxX { get; }
Property Value
MaxY
public double MaxY { get; }
Property Value
MaxZ
public double MaxZ { get; }
Property Value
MinX
public double MinX { get; }
Property Value
MinY
public double MinY { get; }
Property Value
MinZ
public double MinZ { get; }
Property Value
Start
public Vec3d Start { get; }
Property Value
Width
MaxX-MinX
public double Width { get; }
Property Value
Methods
Clone()
Creates a copy of the cuboid
public Cuboidd Clone()
Returns
Contains(double, double, double)
Returns if the given point is inside the cuboid
public bool Contains(double x, double y, double z)
Parameters
Returns
ContainsOrTouches(double, double, double)
Returns if the given point is inside the cuboid
public bool ContainsOrTouches(double x, double y, double z)
Parameters
Returns
ContainsOrTouches(IVec3)
Returns if the given point is inside the cuboid
public bool ContainsOrTouches(IVec3 vec)
Parameters
vec
IVec3
Returns
Equals(Cuboidd)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Cuboidd other)
Parameters
other
CuboiddAn object to compare with this object.
Returns
GrowBy(double, double, double)
public Cuboidd GrowBy(double dx, double dy, double dz)
Parameters
Returns
GrowToInclude(int, int, int)
Grows the cuboid so that it includes the given block
public Cuboidd GrowToInclude(int x, int y, int z)
Parameters
Returns
GrowToInclude(IVec3)
Grows the cuboid so that it includes the given block
public Cuboidd GrowToInclude(IVec3 vec)
Parameters
vec
IVec3
Returns
Intersects(Cuboidd)
If the given cuboid intersects with this cuboid
public bool Intersects(Cuboidd other)
Parameters
other
Cuboidd
Returns
Intersects(Cuboidf)
If the given cuboid intersects with this cuboid
public bool Intersects(Cuboidf other)
Parameters
other
Cuboidf
Returns
Intersects(Cuboidf, double, double, double)
public bool Intersects(Cuboidf other, double offsetx, double offsety, double offsetz)
Parameters
Returns
Intersects(Cuboidf, Vec3d)
If the given cuboid intersects with this cuboid
public bool Intersects(Cuboidf other, Vec3d offset)
Parameters
Returns
IntersectsOrTouches(Cuboidd)
If the given cuboid intersects with this cuboid
public bool IntersectsOrTouches(Cuboidd other)
Parameters
other
Cuboidd
Returns
IntersectsOrTouches(Cuboidf, double, double, double)
If the given cuboid intersects with this cuboid
public bool IntersectsOrTouches(Cuboidf other, double offsetX, double offsetY, double offsetZ)
Parameters
Returns
IntersectsOrTouches(Cuboidf, Vec3d)
If the given cuboid intersects with this cuboid
public bool IntersectsOrTouches(Cuboidf other, Vec3d offset)
Parameters
Returns
Offset(double, double, double)
public Cuboidd Offset(double dx, double dy, double dz)
Parameters
Returns
OffsetCopy(double, double, double)
Returns a new cuboid offseted by given position
public Cuboidd OffsetCopy(double x, double y, double z)
Parameters
Returns
OffsetCopy(IVec3)
Returns a new cuboid offseted by given position
public Cuboidd OffsetCopy(IVec3 vec)
Parameters
vec
IVec3
Returns
RemoveRoundingErrors()
public void RemoveRoundingErrors()
RotatedCopy(double, double, double, Vec3d)
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.
public Cuboidd RotatedCopy(double degX, double degY, double degZ, Vec3d origin)
Parameters
Returns
RotatedCopy(IVec3, Vec3d)
Performs a 3-dimensional rotation on the cuboid and returns a new axis-aligned cuboid resulting from this rotation. Not sure it makes any sense to use this for other rotations than 90 degree intervals.
public Cuboidd RotatedCopy(IVec3 vec, Vec3d origin)
Parameters
Returns
Set(double, double, double, double, double, double)
Sets the minimum and maximum values of the cuboid
public Cuboidd Set(double x1, double y1, double z1, double x2, double y2, double z2)
Parameters
Returns
Set(Cuboidd)
public void Set(Cuboidd other)
Parameters
other
Cuboidd
Set(Cuboidf)
Sets the minimum and maximum values of the cuboid
public Cuboidd Set(Cuboidf selectionBox)
Parameters
selectionBox
Cuboidf
Returns
Set(IVec3, IVec3)
Sets the minimum and maximum values of the cuboid
public Cuboidd Set(IVec3 min, IVec3 max)
Parameters
Returns
SetAndTranslate(Cuboidf, double, double, double)
Sets the cuboid to the selectionBox, translated by (dX, dY, dZ)
public Cuboidd SetAndTranslate(Cuboidf selectionBox, double dX, double dY, double dZ)
Parameters
Returns
SetAndTranslate(Cuboidf, Vec3d)
Sets the cuboid to the selectionBox, translated by vec
public Cuboidd SetAndTranslate(Cuboidf selectionBox, Vec3d vec)
Parameters
Returns
ShortestDistanceFrom(double, double, double)
Returns the shortest distance between given point and any point inside the cuboid
public double ShortestDistanceFrom(double x, double y, double z)
Parameters
Returns
ShortestDistanceFrom(Cuboidd)
Returns the shortest distance to any point between this and given cuboid
public double ShortestDistanceFrom(Cuboidd cuboid)
Parameters
cuboid
Cuboidd
Returns
ShortestDistanceFrom(Cuboidf, BlockPos)
Returns the shortest distance to any point between this and given cuboid
public double ShortestDistanceFrom(Cuboidf cuboid, BlockPos offset)
Parameters
Returns
ShortestDistanceFrom(IVec3)
Returns the shortest distance between given point and any point inside the cuboid
public double ShortestDistanceFrom(IVec3 vec)
Parameters
vec
IVec3
Returns
ShortestHorizontalDistanceFrom(double, double)
Returns the shortest horizontal distance to any point between this and given coordinate
public double ShortestHorizontalDistanceFrom(double x, double z)
Parameters
Returns
ShortestHorizontalDistanceFrom(Cuboidf, BlockPos)
Returns the shortest horizontal distance to any point between this and given cuboid
public double ShortestHorizontalDistanceFrom(Cuboidf cuboid, BlockPos offset)
Parameters
Returns
ShortestVerticalDistanceFrom(double)
Returns the shortest distance between given point and any point inside the cuboid
public double ShortestVerticalDistanceFrom(double y)
Parameters
y
double
Returns
ShortestVerticalDistanceFrom(Cuboidd)
Returns the shortest vertical distance to any point between this and given cuboid
public double ShortestVerticalDistanceFrom(Cuboidd cuboid)
Parameters
cuboid
Cuboidd
Returns
ShortestVerticalDistanceFrom(Cuboidf, EntityPos)
Returns the shortest distance to any point between this and given cuboid
public double ShortestVerticalDistanceFrom(Cuboidf cuboid, EntityPos offset)
Parameters
Returns
ToCuboidi()
public Cuboidi ToCuboidi()
Returns
ToFloat()
public Cuboidf ToFloat()
Returns
Translate(double, double, double)
Adds the given offset to the cuboid
public Cuboidd Translate(double posX, double posY, double posZ)
Parameters
Returns
Translate(IVec3)
Adds the given offset to the cuboid
public Cuboidd Translate(IVec3 vec)
Parameters
vec
IVec3
Returns
pushOutX(Cuboidd, double, ref EnumPushDirection)
Returns a new x coordinate that's ensured to be outside this cuboid. Used for collision detection.
public double pushOutX(Cuboidd from, double motx, ref EnumPushDirection direction)
Parameters
from
Cuboiddmotx
doubledirection
EnumPushDirection
Returns
pushOutY(Cuboidd, double, ref EnumPushDirection)
Returns a new y coordinate that's ensured to be outside this cuboid. Used for collision detection.
public double pushOutY(Cuboidd from, double moty, ref EnumPushDirection direction)
Parameters
from
Cuboiddmoty
doubledirection
EnumPushDirection
Returns
pushOutZ(Cuboidd, double, ref EnumPushDirection)
Returns a new z coordinate that's ensured to be outside this cuboid. Used for collision detection.
public double pushOutZ(Cuboidd from, double motz, ref EnumPushDirection direction)
Parameters
from
Cuboiddmotz
doubledirection
EnumPushDirection