Table of Contents

Namespace Vintagestory.API.MathTools

Classes

AABBIntersectionTest
AngleConstraint
Ascii85

Converts between binary data and an Ascii85-encoded string.

BlockFacing

Represents one of the 6 faces of a cube and all it's properties. Uses a right Handed Coordinate System. See also http://www.matrix44.net/cms/notes/opengl-3d-graphics/coordinate-systems-in-opengl In short: North: Negative Z East: Positive X South: Positive Z West: Negative X Up: Positive Y Down: Negative Y

BlockPos

A useful data structure when operating with block postions.
Valuable Hint: Make use of Copy() or the XXXCopy() variants where needed. A common pitfall is writing code like: BlockPos abovePos = pos.Up(); - with this code abovePos and pos will reference to the same object!

CachingCollisionTester

Special version of CollisionTester for BehaviorControlledPhysics, which does not re-do the WalkBlocks() call and re-generate the CollisionBoxList more than once in the same entity tick

Cardinal
ClampedSimplexNoise

Perlin noise of supplied amplitude and frequency. The resulting value is clamped to 0...1

CollisionTester
ColorBlend
ColorUtil

Many utility methods and fields for working with colors

ColorUtil.LightUtil

Converts HSV (extracted from light and lightSat) to RGBA

Crc32Algorithm

Implementation of CRC-32. This class supports several convenient static methods returning the CRC as UInt32. From https://github.com/force-net/Crc32.NET

Cuboidd

Represents a three dimensional axis-aligned cuboid using two 3d coordinates. Used for collision and selection withes.

Cuboidf

Represents a three dimensional axis-aligned cuboid using two 3D coordinates. Used for collision and selection boxes.

Cuboidi
Easings
EvolvingNatFloat

A number generator whose return value changes over time, parametrized by a transform function and some constants

FastVec3iComparer
FluidBlockPos
GameMath

A large set of useful game mathematics functions

HorRectanglei
LCGRandom

An lcg random generator, particularly suitable for worldgen See also https://en.wikipedia.org/wiki/Linear_congruential_generator

Line3D
MapUtil
Mat22

2x2 Matrix

Mat23

2x3 Matrix

  • A mat2d contains six elements defined as:
  • [a, b,
  • c, d,
  • tx,ty]
  • This is a short form for the 3x3 matrix:
  • [a, b, 0
  • c, d, 0
  • tx,ty,1]
  • The last column is ignored so the array is shorter and operations are faster.
Mat3d
Mat3f
Mat4d

4x4 Matrix Math

Mat4f

4x4 Matrix Math

MultiCollisionTester
NatFloat

A more natural random number generator (nature usually doesn't grow by the exact same numbers nor does it completely randomly)

NewNormalizedSimplexFractalNoise
NewSimplexNoiseLayer
NormalRandom
NormalizedSimplexNoise

It's generally pretty hard to get a neatly normalized coherent noise function due to the way perlin/open simplex works (gauss curve) and how random numbers are generated. So instead of trying to find the perfect normalization factor and instead try to perform some approximate normalization this class allows a small overflow and brings it down very close to the [0, 1] range using tanh().

Returns values in a range of [0..1]

Quaterniond
Quaternionf
Ray
ShapeUtil
SimplexNoise

OpenSimplex noise of supplied amplitude and frequency.

SimplexNoiseOctave

OpenSimplex Noise in C# Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19 by KdotJPG and heavily refactored to improve performance.

Size2d

Represents a vector of 2 doubles. Go bug Tyron of you need more utility methods in this class.

Size2f

Represents a vector of 2 doubles. Go bug Tyron of you need more utility methods in this class.

Size2i

Represents a vector of 2 doubles. Go bug Tyron of you need more utility methods in this class.

Size3d

Represents a vector of 3 doubles. Go bug Tyron of you need more utility methods in this class.

Size3f

Represents a vector of 3 floats. Go bug Tyron of you need more utility methods in this class.

Size3i

Represents a vector of 3 integers. Go bug Tyron of you need more utility methods in this class.

SkColorFix
Vec2d

Represents a vector of 2 doubles. Go bug Tyron of you need more utility methods in this class.

Vec2f

Represents a vector of 2 floats. Go bug Tyron of you need more utility methods in this class.

Vec2i

Represents a vector of 2 ints. Go bug Tyron if you need more utility methods in this class.

Vec3Utilsd

Don't use this class unless you need it to interoperate with Mat4d

Vec3Utilsf

Don't use this class unless you need it to interoperate with Mat4d

Vec3d

Represents a vector of 3 doubles. Go bug Tyron of you need more utility methods in this class.

Vec3f

Represents a vector of 3 floats. Go bug Tyron of you need more utility methods in this class.

Vec3i

Represents a vector of 3 ints. Go bug Tyron if you need more utility methods in this class.

Vec3iAndFacingFlags
Vec4d
Vec4f
Vec4i

Represents a vector of 4 ints. Go bug Tyron if you need more utility methods in this class.

Vec4i<T>
Vec4s

Represents a vector of 4 shorts. Go bug Tyron if you need more utility methods in this class.

Vec4s<T>
Vec4us

Represents a vector of 4 unsigned shorts. Go bug Tyron if you need more utility methods in this class.

Vec4us<T>
WeightedFloat
WeightedFloatArray
WeightedInt
WeightedValue<T>

Structs

FastVec3d

Represents a vector of 3 doubles

FastVec3f

Represents a vector of 3 floats. Go bug Tyron of you need more utility methods in this class.

FastVec3i

Represents a vector of 3 ints, similar to a Vec3i or a BlockPos but this is a struct

NewNormalizedSimplexFractalNoise.ColumnNoise
NormalizedSimplexNoise.ColumnNoise
Rectanglei
Sphere

Not really a sphere, actually now an AABB centred on x,y,z, but we keep the name for API consistency

VSColor

Interfaces

IRandom
IVec3
IWorldIntersectionSupplier

Enums

EnumAxis

Represents an axis in the cartesian coordinate system

EnumColorBlendMode

Specifies types of per-pixel color blending.

EnumCombination

Used to define how variant types interact with each other to create unique objects.

EnumDistribution

The distribution of the random numbers

EnumIntersect
EnumPushDirection
EnumTransformFunction

Used for EvolvingNatFloat value transforms

Delegates

BlockFilter
ColorBlend.ColorBlendDelegate
EntityFilter
PlotDelegate2D
PlotDelegate3D
PlotDelegate3DBlockPos
TransformFunction