Table of Contents

Namespace Vintagestory.API.MathTools

Classes

AABBIntersectionTest

Open in GitHub

AngleConstraint

Open in GitHub

Ascii85

Converts between binary data and an Ascii85-encoded string. Open in GitHub

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 Open in GitHub

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! Open in GitHub

CachingCollisionTester

Originally intended to be a 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
Currently in 1.20 the caching is not very useful when we loop through all entities sequentially - but empirical testing shows it is actually faster not to cache Open in GitHub

Cardinal

Open in GitHub

ClampedSimplexNoise

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

CollisionTester

Open in GitHub

ColorBlend

Open in GitHub

ColorUtil

Many utility methods and fields for working with colors Open in GitHub

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 Open in GitHub

Cuboidd

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

Cuboidf

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

Cuboidi

A 3D cuboid, created out of integers. Open in GitHub

Easings

Open in GitHub

EvolvingNatFloat

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

FastVec3iComparer

Open in GitHub

FluidBlockPos

Open in GitHub

GameMath

A large set of useful game mathematics functions Open in GitHub

HorRectanglei

Open in GitHub

LCGRandom

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

Line3D

Open in GitHub

MapUtil

Open in GitHub

Mat22

2x2 Matrix Open in GitHub

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. Open in GitHub
Mat3d

Open in GitHub

Mat3f

Open in GitHub

Mat4d

4x4 Matrix Math Open in GitHub

Mat4f

4x4 Matrix Math Open in GitHub

MultiCollisionTester

Open in GitHub

NatFloat

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

NewNormalizedSimplexFractalNoise

Open in GitHub

NewSimplexNoiseLayer

Open in GitHub

NormalRandom

Open in GitHub

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] Open in GitHub

Quaterniond

Open in GitHub

Quaternionf

Open in GitHub

Ray

Open in GitHub

ShapeUtil

Open in GitHub

SimplexNoise

OpenSimplex noise of supplied amplitude and frequency. Open in GitHub

SimplexNoiseOctave

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

Size2d

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

Size2f

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

Size2i

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

Size3d

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

Size3f

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

Size3i

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

SkColorFix

Open in GitHub

Vec2d

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

Vec2f

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

Vec2i

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

Vec3Utilsd

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

Vec3Utilsf

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

Vec3d

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

Vec3f

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

Vec3i

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

Vec3iAndFacingFlags

Open in GitHub

Vec4d

Open in GitHub

Vec4f

Open in GitHub

Vec4i

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

Vec4i<T>
Vec4s

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

Vec4s<T>
Vec4us

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

Vec4us<T>
WeightedFloat

Open in GitHub

WeightedFloatArray

Open in GitHub

WeightedInt

Open in GitHub

WeightedValue<T>

Structs

FastVec2i

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

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

ThreeBytes

For performance, intended to compile equivalently to a byte[3], but more RAM efficient and more GC efficient

VSColor

Interfaces

IRandom
IVec3
IWorldIntersectionSupplier

Enums

EnumAxis

Represents an axis in the cartesian coordinate system Open in GitHub

EnumColorBlendMode

Specifies types of per-pixel color blending. Open in GitHub

EnumCombination

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

EnumDistribution

The distribution of the random numbers Open in GitHub

EnumIntersect

Open in GitHub

EnumPushDirection

Open in GitHub

EnumTransformFunction

Used for EvolvingNatFloat value transforms Open in GitHub

Delegates

BlockFilter
ColorBlend.ColorBlendDelegate
EntityFilter
PlotDelegate2D
PlotDelegate3D
PlotDelegate3DBlockPos
TransformFunction