Class Cuboidi
- Namespace
- Vintagestory.API.MathTools
- Assembly
- VintagestoryAPI.dll
[ProtoContract]
public class Cuboidi : IEquatable<Cuboidi>
- Inheritance
-
Cuboidi
- Implements
- Inherited Members
- Extension Methods
Constructors
Cuboidi()
public Cuboidi()
Cuboidi(int, int, int, int, int, int)
public Cuboidi(int x1, int y1, int z1, int x2, int y2, int z2)
Parameters
Cuboidi(int[])
public Cuboidi(int[] coordinates)
Parameters
coordinates
int[]
Cuboidi(BlockPos, int)
public Cuboidi(BlockPos startPos, int size)
Parameters
Cuboidi(BlockPos, BlockPos)
public Cuboidi(BlockPos startPos, BlockPos endPos)
Parameters
Cuboidi(Vec3i, Vec3i)
public Cuboidi(Vec3i startPos, Vec3i endPos)
Parameters
Fields
X1
[ProtoMember(1)]
public int X1
Field Value
X2
[ProtoMember(4)]
public int X2
Field Value
Y1
[ProtoMember(2)]
public int Y1
Field Value
Y2
[ProtoMember(5)]
public int Y2
Field Value
Z1
[ProtoMember(3)]
public int Z1
Field Value
Z2
[ProtoMember(6)]
public int Z2
Field Value
Properties
Center
public Vec3i Center { get; }
Property Value
CenterX
public int CenterX { get; }
Property Value
CenterY
public int CenterY { get; }
Property Value
CenterZ
public int CenterZ { get; }
Property Value
Coordinates
public int[] Coordinates { get; }
Property Value
- int[]
End
public Vec3i End { get; }
Property Value
MaxX
public int MaxX { get; }
Property Value
MaxY
public int MaxY { get; }
Property Value
MaxZ
public int MaxZ { get; }
Property Value
MinX
public int MinX { get; }
Property Value
MinY
public int MinY { get; }
Property Value
MinZ
public int MinZ { get; }
Property Value
SizeX
public int SizeX { get; }
Property Value
SizeXYZ
public int SizeXYZ { get; }
Property Value
SizeXZ
public int SizeXZ { get; }
Property Value
SizeY
public int SizeY { get; }
Property Value
SizeZ
public int SizeZ { get; }
Property Value
Start
public Vec3i Start { get; }
Property Value
Volume
public int Volume { get; }
Property Value
Methods
Clone()
Creates a copy of the cuboid
public Cuboidi Clone()
Returns
Contains(int, int)
Returns if the given point is inside the cuboid
public bool Contains(int x, int z)
Parameters
Returns
Contains(int, int, int)
Returns if the given point is inside the cuboid
public bool Contains(int x, int y, int z)
Parameters
Returns
Contains(BlockPos)
Returns if the given point is inside the cuboid
public bool Contains(BlockPos pos)
Parameters
pos
BlockPos
Returns
Contains(IVec3)
public bool Contains(IVec3 pos)
Parameters
pos
IVec3
Returns
Contains(Vec3d)
public bool Contains(Vec3d pos)
Parameters
pos
Vec3d
Returns
ContainsOrTouches(int, int, int)
Returns if the given point is inside the cuboid
public bool ContainsOrTouches(int x, int y, int z)
Parameters
Returns
ContainsOrTouches(EntityPos)
Returns if the given entityPos is inside the cuboid
public bool ContainsOrTouches(EntityPos pos)
Parameters
pos
EntityPos
Returns
ContainsOrTouches(BlockPos)
Returns if the given point is inside the cuboid
public bool ContainsOrTouches(BlockPos pos)
Parameters
pos
BlockPos
Returns
ContainsOrTouches(Cuboidi)
public bool ContainsOrTouches(Cuboidi cuboid)
Parameters
cuboid
Cuboidi
Returns
ContainsOrTouches(IVec3)
Returns if the given point is inside the cuboid
public bool ContainsOrTouches(IVec3 vec)
Parameters
vec
IVec3
Returns
Div(int)
Divides the given value to the cuboid
public Cuboidi Div(int value)
Parameters
value
int
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
Equals(Cuboidi)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Cuboidi other)
Parameters
other
CuboidiAn object to compare with this object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GrowBy(int, int, int)
public Cuboidi GrowBy(int dx, int dy, int dz)
Parameters
Returns
GrowToInclude(int, int, int)
Grows the cuboid so that it includes the given block
public Cuboidi GrowToInclude(int x, int y, int z)
Parameters
Returns
GrowToInclude(IVec3)
Grows the cuboid so that it includes the given block
public Cuboidi GrowToInclude(IVec3 vec)
Parameters
vec
IVec3
Returns
Intersects(Cuboidi)
If the given cuboid intersects with this cubiod
public bool Intersects(Cuboidi with)
Parameters
with
Cuboidi
Returns
Intersects(HorRectanglei)
Ignores the y-axis
public bool Intersects(HorRectanglei with)
Parameters
with
HorRectanglei
Returns
IntersectsOrTouches(Cuboidi)
If the given cuboid intersects with or is adjacent to this cubiod
public bool IntersectsOrTouches(Cuboidi with)
Parameters
with
Cuboidi
Returns
OffsetCopy(int, int, int)
Returns a new cuboid offseted by given position
public Cuboidi OffsetCopy(int x, int y, int z)
Parameters
Returns
OffsetCopy(IVec3)
Returns a new cuboid offseted by given position
public Cuboidi OffsetCopy(IVec3 vec)
Parameters
vec
IVec3
Returns
RotatedCopy(int, int, int, 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 Cuboidi RotatedCopy(int degX, int degY, int 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 it makes any sense to use this for other rotations than 90 degree intervals.
public Cuboidi RotatedCopy(IVec3 vec, Vec3d origin)
Parameters
Returns
Set(int, int, int, int, int, int)
Sets the minimum and maximum values of the cuboid
public Cuboidi Set(int x1, int y1, int z1, int x2, int y2, int z2)
Parameters
Returns
Set(IVec3, IVec3)
Sets the minimum and maximum values of the cuboid
public Cuboidi Set(IVec3 min, IVec3 max)
Parameters
Returns
ShortestDistanceFrom(int, int, int)
Returns the shortest distance between given point and any point inside the cuboid
public double ShortestDistanceFrom(int x, int y, int z)
Parameters
Returns
ShortestDistanceFrom(Cuboidi)
Returns the shortest distance to any point between this and given cuboid
public double ShortestDistanceFrom(Cuboidi cuboid)
Parameters
cuboid
Cuboidi
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
Sub(int, int, int)
Substractes the given offset to the cuboid
public Cuboidi Sub(int posX, int posY, int posZ)
Parameters
Returns
Sub(IVec3)
Substractes the given offset to the cuboid
public Cuboidi Sub(IVec3 vec)
Parameters
vec
IVec3
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Translate(int, int, int)
Adds the given offset to the cuboid
public Cuboidi Translate(int posX, int posY, int posZ)
Parameters
Returns
Translate(IVec3)
Adds the given offset to the cuboid
public Cuboidi Translate(IVec3 vec)
Parameters
vec
IVec3
Returns
pushOutX(Cuboidi, int, ref EnumPushDirection)
Returns a new x coordinate that's ensured to be outside this cuboid. Used for collision detection.
public double pushOutX(Cuboidi from, int x, ref EnumPushDirection direction)
Parameters
from
Cuboidix
intdirection
EnumPushDirection
Returns
pushOutY(Cuboidi, int, ref EnumPushDirection)
Returns a new y coordinate that's ensured to be outside this cuboid. Used for collision detection.
public double pushOutY(Cuboidi from, int y, ref EnumPushDirection direction)
Parameters
from
Cuboidiy
intdirection
EnumPushDirection
Returns
pushOutZ(Cuboidi, int, ref EnumPushDirection)
Returns a new z coordinate that's ensured to be outside this cuboid. Used for collision detection.
public double pushOutZ(Cuboidi from, int z, ref EnumPushDirection direction)
Parameters
from
Cuboidiz
intdirection
EnumPushDirection