Table of Contents

Class Cuboidi

Namespace
Vintagestory.API.MathTools
Assembly
VintagestoryAPI.dll
[ProtoContract]
public class Cuboidi : IEquatable<Cuboidi>
Inheritance
Cuboidi
Implements
Inherited Members

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

x1 int
y1 int
z1 int
x2 int
y2 int
z2 int

Cuboidi(int[])

public Cuboidi(int[] coordinates)

Parameters

coordinates int[]

Cuboidi(BlockPos, int)

public Cuboidi(BlockPos startPos, int size)

Parameters

startPos BlockPos
size int

Cuboidi(BlockPos, BlockPos)

public Cuboidi(BlockPos startPos, BlockPos endPos)

Parameters

startPos BlockPos
endPos BlockPos

Cuboidi(Vec3i, Vec3i)

public Cuboidi(Vec3i startPos, Vec3i endPos)

Parameters

startPos Vec3i
endPos Vec3i

Fields

X1

[ProtoMember(1)]
public int X1

Field Value

int

X2

[ProtoMember(4)]
public int X2

Field Value

int

Y1

[ProtoMember(2)]
public int Y1

Field Value

int

Y2

[ProtoMember(5)]
public int Y2

Field Value

int

Z1

[ProtoMember(3)]
public int Z1

Field Value

int

Z2

[ProtoMember(6)]
public int Z2

Field Value

int

Properties

Center

public Vec3i Center { get; }

Property Value

Vec3i

CenterX

public int CenterX { get; }

Property Value

int

CenterY

public int CenterY { get; }

Property Value

int

CenterZ

public int CenterZ { get; }

Property Value

int

Coordinates

public int[] Coordinates { get; }

Property Value

int[]

End

public Vec3i End { get; }

Property Value

Vec3i

MaxX

public int MaxX { get; }

Property Value

int

MaxY

public int MaxY { get; }

Property Value

int

MaxZ

public int MaxZ { get; }

Property Value

int

MinX

public int MinX { get; }

Property Value

int

MinY

public int MinY { get; }

Property Value

int

MinZ

public int MinZ { get; }

Property Value

int

SizeX

public int SizeX { get; }

Property Value

int

SizeXYZ

public int SizeXYZ { get; }

Property Value

int

SizeXZ

public int SizeXZ { get; }

Property Value

int

SizeY

public int SizeY { get; }

Property Value

int

SizeZ

public int SizeZ { get; }

Property Value

int

Start

public Vec3i Start { get; }

Property Value

Vec3i

Volume

public int Volume { get; }

Property Value

int

Methods

Clone()

Creates a copy of the cuboid

public Cuboidi Clone()

Returns

Cuboidi

Contains(int, int)

Returns if the given point is inside the cuboid

public bool Contains(int x, int z)

Parameters

x int
z int

Returns

bool

Contains(int, int, int)

Returns if the given point is inside the cuboid

public bool Contains(int x, int y, int z)

Parameters

x int
y int
z int

Returns

bool

Contains(BlockPos)

Returns if the given point is inside the cuboid

public bool Contains(BlockPos pos)

Parameters

pos BlockPos

Returns

bool

Contains(IVec3)

public bool Contains(IVec3 pos)

Parameters

pos IVec3

Returns

bool

Contains(Vec3d)

public bool Contains(Vec3d pos)

Parameters

pos Vec3d

Returns

bool

ContainsOrTouches(int, int, int)

Returns if the given point is inside the cuboid

public bool ContainsOrTouches(int x, int y, int z)

Parameters

x int
y int
z int

Returns

bool

ContainsOrTouches(EntityPos)

Returns if the given entityPos is inside the cuboid

public bool ContainsOrTouches(EntityPos pos)

Parameters

pos EntityPos

Returns

bool

ContainsOrTouches(BlockPos)

Returns if the given point is inside the cuboid

public bool ContainsOrTouches(BlockPos pos)

Parameters

pos BlockPos

Returns

bool

ContainsOrTouches(Cuboidi)

public bool ContainsOrTouches(Cuboidi cuboid)

Parameters

cuboid Cuboidi

Returns

bool

ContainsOrTouches(IVec3)

Returns if the given point is inside the cuboid

public bool ContainsOrTouches(IVec3 vec)

Parameters

vec IVec3

Returns

bool

Div(int)

Divides the given value to the cuboid

public Cuboidi Div(int value)

Parameters

value int

Returns

Cuboidi

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(Cuboidi)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Cuboidi other)

Parameters

other Cuboidi

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

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

dx int
dy int
dz int

Returns

Cuboidi

GrowToInclude(int, int, int)

Grows the cuboid so that it includes the given block

public Cuboidi GrowToInclude(int x, int y, int z)

Parameters

x int
y int
z int

Returns

Cuboidi

GrowToInclude(IVec3)

Grows the cuboid so that it includes the given block

public Cuboidi GrowToInclude(IVec3 vec)

Parameters

vec IVec3

Returns

Cuboidi

Intersects(Cuboidi)

If the given cuboid intersects with this cubiod

public bool Intersects(Cuboidi with)

Parameters

with Cuboidi

Returns

bool

Intersects(HorRectanglei)

Ignores the y-axis

public bool Intersects(HorRectanglei with)

Parameters

with HorRectanglei

Returns

bool

IntersectsOrTouches(Cuboidi)

If the given cuboid intersects with or is adjacent to this cubiod

public bool IntersectsOrTouches(Cuboidi with)

Parameters

with Cuboidi

Returns

bool

OffsetCopy(int, int, int)

Returns a new cuboid offseted by given position

public Cuboidi OffsetCopy(int x, int y, int z)

Parameters

x int
y int
z int

Returns

Cuboidi

OffsetCopy(IVec3)

Returns a new cuboid offseted by given position

public Cuboidi OffsetCopy(IVec3 vec)

Parameters

vec IVec3

Returns

Cuboidi

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

degX int
degY int
degZ int
origin Vec3d

Returns

Cuboidi

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

vec IVec3
origin Vec3d

Returns

Cuboidi

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

x1 int
y1 int
z1 int
x2 int
y2 int
z2 int

Returns

Cuboidi

Set(IVec3, IVec3)

Sets the minimum and maximum values of the cuboid

public Cuboidi Set(IVec3 min, IVec3 max)

Parameters

min IVec3
max IVec3

Returns

Cuboidi

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

x int
y int
z int

Returns

double

ShortestDistanceFrom(Cuboidi)

Returns the shortest distance to any point between this and given cuboid

public double ShortestDistanceFrom(Cuboidi cuboid)

Parameters

cuboid Cuboidi

Returns

double

ShortestDistanceFrom(IVec3)

Returns the shortest distance between given point and any point inside the cuboid

public double ShortestDistanceFrom(IVec3 vec)

Parameters

vec IVec3

Returns

double

Sub(int, int, int)

Substractes the given offset to the cuboid

public Cuboidi Sub(int posX, int posY, int posZ)

Parameters

posX int
posY int
posZ int

Returns

Cuboidi

Sub(IVec3)

Substractes the given offset to the cuboid

public Cuboidi Sub(IVec3 vec)

Parameters

vec IVec3

Returns

Cuboidi

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

posX int
posY int
posZ int

Returns

Cuboidi

Translate(IVec3)

Adds the given offset to the cuboid

public Cuboidi Translate(IVec3 vec)

Parameters

vec IVec3

Returns

Cuboidi

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 Cuboidi
x int
direction EnumPushDirection

Returns

double

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 Cuboidi
y int
direction EnumPushDirection

Returns

double

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 Cuboidi
z int
direction EnumPushDirection

Returns

double