载入中...
搜索中...
未找到
eve::math::Math类 参考

Math module — glm-backed vectors/matrices, noise, bezier, random. Script: math <- eve.Math(); 更多...

#include <Math.h>

类 eve::math::Math 继承关系图:
eve::Module

Public 成员函数

 Module_REG (Math)
 
 Math ()
 Initializes RNG and math helpers.
 
 ~Math () override=default
 Releases module state; caller-owned Vec/Mat pointers are not freed.
 
Vec2 * newVec2 (float x=0.f, float y=0.f)
 Allocates a Vec2. @ownership Caller deletes.
 
Vec3 * newVec3 (float x=0.f, float y=0.f, float z=0.f)
 Allocates a Vec3. @ownership Caller deletes.
 
Mat4 * newMat4 ()
 Allocates an identity Mat4. @ownership Caller deletes.
 
Mat4 * newMat4Translation (float x, float y, float z)
 Allocates a translation Mat4. @ownership Caller deletes.
 
Mat4 * newMat4Scale (float sx, float sy, float sz)
 Allocates a scale Mat4. @ownership Caller deletes.
 
Mat4 * newMat4RotationZ (float radians)
 Allocates a Z-rotation Mat4 (radians). @ownership Caller deletes.
 
float clamp (float x, float lo, float hi) const
 Clamps x into [lo, hi].
 
float lerp (float a, float b, float t) const
 Linear interpolation between a and b by t.
 
float smoothstep (float edge0, float edge1, float x) const
 Hermite smoothstep between edge0 and edge1.
 
float remap (float x, float inMin, float inMax, float outMin, float outMax) const
 Maps x from [inMin,inMax] into [outMin,outMax].
 
float degToRad (float deg) const
 Degrees to radians.
 
float radToDeg (float rad) const
 Radians to degrees.
 
float sign (float x) const
 Sign of x (-1, 0, or 1).
 
float fract (float x) const
 Fractional part of x.
 
float approach (float current, float target, float maxDelta) const
 Moves current toward target by at most maxDelta.
 
float wrap (float x, float lo, float hi) const
 Wraps x into [lo, hi).
 
float pingPong (float t, float length) const
 Triangle-wave ping-pong of t over [0, length].
 
float inverseLerp (float a, float b, float x) const
 Linear interpolation between a and b by t.
 
float smootherstep (float edge0, float edge1, float x) const
 Ken Perlin smootherstep between edge0 and edge1.
 
float bias (float t, float b) const
 Schlick bias/gain — shape [0,1] distributions (procgen falloff).
 
float gain (float t, float g) const
 Schlick gain shaping of t in [0,1].
 
float ease (float t, const std::string &kind) const
 Easing on [0,1]. kind: "linear"|"inQuad"|"outQuad"|"inOutQuad"|"inCubic"|"outCubic"|"inOutCubic"| "inSine"|"outSine"|"inOutSine"|"inExpo"|"outExpo"|"inOutExpo"
 
float step (float edge, float x) const
 Heaviside step: 0 if x < edge else 1.
 
float quantize (float x, float stepSize) const
 Quantizes x to multiples of stepSize.
 
float snap (float x, float grid) const
 Snaps x to the nearest grid multiple.
 
float length2 (float x, float y) const
 2D vector length from components.
 
float length3 (float x, float y, float z) const
 3D vector length from components.
 
float distance2 (float x1, float y1, float x2, float y2) const
 2D distance between two points.
 
float distance3 (float x1, float y1, float z1, float x2, float y2, float z2) const
 3D distance between two points.
 
float dot2 (float x1, float y1, float x2, float y2) const
 2D dot product of two vectors.
 
float dot3 (float x1, float y1, float z1, float x2, float y2, float z2) const
 3D dot product of two vectors.
 
float cross2 (float x1, float y1, float x2, float y2) const
 2D cross product (scalar z-component).
 
float angle2 (float x, float y) const
 Atan2 angle of (x,y) in radians.
 
float angleBetween2 (float x1, float y1, float x2, float y2) const
 Signed angle from first vector to second.
 
float lerpAngle (float a, float b, float t) const
 Shortest-path angle interpolation.
 
float normalize2X (float x, float y) const
 X of the normalized 2D vector (zero-safe).
 
float normalize2Y (float x, float y) const
 Y of the normalized 2D vector (zero-safe).
 
float normalize3X (float x, float y, float z) const
 X of the normalized 3D vector (zero-safe).
 
float normalize3Y (float x, float y, float z) const
 Y of the normalized 3D vector (zero-safe).
 
float normalize3Z (float x, float y, float z) const
 Z of the normalized 3D vector (zero-safe).
 
Vec2 * steeringSeek2 (float x, float y, float targetX, float targetY, float maxSpeed) const
 Creates a 2D seek velocity. @ownership owned @lifetime Caller deletes the result.
 
Vec3 * steeringSeek3 (float x, float y, float z, float targetX, float targetY, float targetZ, float maxSpeed) const
 Creates a 3D seek velocity. @ownership owned @lifetime Caller deletes the result.
 
Vec2 * steeringFlee2 (float x, float y, float targetX, float targetY, float maxSpeed) const
 Creates a 2D flee velocity. @ownership owned @lifetime Caller deletes the result.
 
Vec3 * steeringFlee3 (float x, float y, float z, float targetX, float targetY, float targetZ, float maxSpeed) const
 Creates a 3D flee velocity. @ownership owned @lifetime Caller deletes the result.
 
Vec2 * steeringArrive2 (float x, float y, float targetX, float targetY, float maxSpeed, float slowRadius, float stopRadius) const
 Creates a 2D arrive velocity. @ownership owned @lifetime Caller deletes the result.
 
Vec3 * steeringArrive3 (float x, float y, float z, float targetX, float targetY, float targetZ, float maxSpeed, float slowRadius, float stopRadius) const
 Creates a 3D arrive velocity. @ownership owned @lifetime Caller deletes the result.
 
Vec2 * steeringSeparation2 (float x, float y, const std::string &neighbors, float radius, float maxAcceleration) const
 Creates 2D separation acceleration from CSV. @ownership owned @lifetime Caller deletes the result.
 
Vec3 * steeringSeparation3 (float x, float y, float z, const std::string &neighbors, float radius, float maxAcceleration) const
 Creates 3D separation acceleration from CSV. @ownership owned @lifetime Caller deletes the result.
 
int steeringPathTarget2 (float x, float y, const std::string &points, int current, float tolerance) const
 Selects a 2D path point from CSV x:y points, or -1 for no valid points.
 
int steeringPathTarget3 (float x, float y, float z, const std::string &points, int current, float tolerance) const
 Selects a 3D path point from CSV x:y:z points, or -1 for no valid points.
 
Vec2 * steeringAvoid2 (float x, float y, float velocityX, float velocityY, float obstacleX, float obstacleY, float obstacleRadius, float lookAhead, float maxAcceleration) const
 Creates 2D avoidance acceleration. @ownership owned @lifetime Caller deletes the result.
 
Vec3 * steeringAvoid3 (float x, float y, float z, float velocityX, float velocityY, float velocityZ, float obstacleX, float obstacleY, float obstacleZ, float obstacleRadius, float lookAhead, float maxAcceleration) const
 Creates 3D avoidance acceleration. @ownership owned @lifetime Caller deletes the result.
 
float rotate2X (float x, float y, float radians) const
 Rotate (x,y) by radians around origin.
 
float rotate2Y (float x, float y, float radians) const
 Y after rotating (x,y) by radians about the origin.
 
float polarX (float radius, float radians) const
 X of polar (radius, radians).
 
float polarY (float radius, float radians) const
 Y of polar (radius, radians).
 
float cartesianRadius (float x, float y) const
 Length of (x,y).
 
float cartesianAngle (float x, float y) const
 Atan2 angle of (x,y).
 
bool pointInCircle (float px, float py, float cx, float cy, float radius) const
 True if point is inside or on the circle.
 
bool pointInRect (float px, float py, float rx, float ry, float rw, float rh) const
 True if point is inside or on the axis-aligned rect.
 
bool circlesOverlap (float x1, float y1, float r1, float x2, float y2, float r2) const
 True if two circles overlap.
 
bool rectsOverlap (float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2) const
 True if two axis-aligned rects overlap.
 
bool circleRectOverlap (float cx, float cy, float radius, float rx, float ry, float rw, float rh) const
 True if circle and axis-aligned rect overlap.
 
bool segmentsIntersect (float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy) const
 True if segments AB and CD intersect (including endpoints).
 
float raycastCircle2 (float ox, float oy, float dx, float dy, float cx, float cy, float radius) const
 Ray vs circle. Hit point = (ox,oy) + t*(dx,dy). Returns t >= 0 on hit, else -1. Direction need not be unit; for a segment use dir = B-A and accept t in [0,1].
 
float raycastRect2 (float ox, float oy, float dx, float dy, float rx, float ry, float rw, float rh) const
 Ray vs axis-aligned rect (x,y,w,h). Returns parametric t >= 0, else -1.
 
float closestPointOnSegment2X (float px, float py, float ax, float ay, float bx, float by) const
 X of the closest point on segment AB to P.
 
float closestPointOnSegment2Y (float px, float py, float ax, float ay, float bx, float by) const
 Y of the closest point on segment AB to P.
 
bool pointInSphere (float px, float py, float pz, float cx, float cy, float cz, float radius) const
 True if point is inside or on the sphere.
 
bool pointInBox (float px, float py, float pz, float minX, float minY, float minZ, float maxX, float maxY, float maxZ) const
 Inclusive AABB test against [min,max] on each axis.
 
bool spheresOverlap (float x1, float y1, float z1, float r1, float x2, float y2, float z2, float r2) const
 True if two spheres overlap.
 
bool boxesOverlap (float minAx, float minAy, float minAz, float maxAx, float maxAy, float maxAz, float minBx, float minBy, float minBz, float maxBx, float maxBy, float maxBz) const
 True if two AABBs overlap.
 
float raycastSphere (float ox, float oy, float oz, float dx, float dy, float dz, float cx, float cy, float cz, float radius) const
 Ray vs sphere; parametric t >= 0 on hit, else -1.
 
float raycastBox (float ox, float oy, float oz, float dx, float dy, float dz, float minX, float minY, float minZ, float maxX, float maxY, float maxZ) const
 Ray vs AABB; parametric t >= 0 on hit, else -1.
 
float raycastPlane (float ox, float oy, float oz, float dx, float dy, float dz, float px, float py, float pz, float nx, float ny, float nz) const
 Ray vs infinite plane through (px,py,pz) with normal (nx,ny,nz). Returns parametric t, or -1 if parallel / behind ray origin.
 
float closestPointOnSegment3X (float px, float py, float pz, float ax, float ay, float az, float bx, float by, float bz) const
 X of the closest point on segment AB to P.
 
float closestPointOnSegment3Y (float px, float py, float pz, float ax, float ay, float az, float bx, float by, float bz) const
 Y of the closest point on segment AB to P.
 
float closestPointOnSegment3Z (float px, float py, float pz, float ax, float ay, float az, float bx, float by, float bz) const
 Z of the closest point on segment AB to P.
 
float bilinear (float v00, float v10, float v01, float v11, float u, float v) const
 Bilinear sample of 4 corners (v00,v10,v01,v11) with u,v in [0,1].
 
void setRandomSeed (uint32_t seed)
 Sets the module RNG seed.
 
void setRandomSeedFromTime ()
 Seeds the RNG from the system clock.
 
uint32_t getRandomSeed () const
 Current RNG seed value.
 
float random ()
 Uniform float in [0, 1).
 
float randomRange (float min, float max)
 Uniform float in [min, max).
 
int randomInt (int min, int maxInclusive)
 Uniform inclusive integer in [min, maxInclusive].
 
float randomGaussian (float mean, float stddev)
 Box-Muller Gaussian (mean, stddev).
 
float hash1 (float x) const
 Deterministic 1D hash mapped to [0,1].
 
float hash2 (float x, float y) const
 Deterministic 2D hash mapped to [0,1].
 
float hash3 (float x, float y, float z) const
 Deterministic 3D hash mapped to [0,1].
 
float noise1 (float x) const
 Value noise in 1D, range [0,1].
 
float noise2 (float x, float y) const
 Value noise in 2D, range [0,1].
 
float noise3 (float x, float y, float z) const
 Value noise in 3D, range [0,1].
 
float perlin2 (float x, float y) const
 Perlin noise in 2D, range [0,1].
 
float perlin3 (float x, float y, float z) const
 Perlin noise in 3D, range [0,1].
 
float fbm2 (float x, float y, int octaves=4, float lacunarity=2.f, float gain=0.5f) const
 Fractal Brownian Motion / ridged / turbulence. octaves >= 1; lacunarity ~2; gain/persistence ~0.5.
 
float fbm3 (float x, float y, float z, int octaves=4, float lacunarity=2.f, float gain=0.5f) const
 3D fractal Brownian motion.
 
float ridged2 (float x, float y, int octaves=4, float lacunarity=2.f, float gain=0.5f) const
 2D ridged multifractal noise.
 
float ridged3 (float x, float y, float z, int octaves=4, float lacunarity=2.f, float gain=0.5f) const
 3D ridged multifractal noise.
 
float turbulence2 (float x, float y, int octaves=4, float lacunarity=2.f, float gain=0.5f) const
 2D turbulence (absolute fBm).
 
float voronoi2 (float x, float y) const
 Worley / Voronoi F1 distance in [0, ~1.5] (cell size 1). voronoiEdge2 = F2 - F1 (cell borders).
 
float voronoiEdge2 (float x, float y) const
 2D Worley F2-F1 edge distance.
 
float warpNoise2 (float x, float y, float warpAmp=1.f) const
 Domain warp: sample noise at (x,y) + warpAmp * (noise-0.5). Useful for organic terrain / caves.
 
float bezierQuadratic (float t, float p0, float p1, float p2) const
 1D quadratic Bezier at t in [0,1].
 
float bezierCubic (float t, float p0, float p1, float p2, float p3) const
 1D cubic Bezier at t in [0,1].
 
float bezierQuadratic2X (float t, float x0, float y0, float x1, float y1, float x2, float y2) const
 X of a 2D quadratic Bezier at t.
 
float bezierQuadratic2Y (float t, float x0, float y0, float x1, float y1, float x2, float y2) const
 Y of a 2D quadratic Bezier at t.
 
float bezierCubic2X (float t, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) const
 X of a 2D cubic Bezier at t.
 
float bezierCubic2Y (float t, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) const
 Y of a 2D cubic Bezier at t.
 
- Public 成员函数 继承自 eve::Module
virtual ~Module ()
 Module.
 
virtual std::string getName () const =0
 Returns the name.
 

详细描述

Math module — glm-backed vectors/matrices, noise, bezier, random. Script: math <- eve.Math();

No overloads: distinct names (length2/length3, noise1/noise2/…).

在文件 Math.h 第 23 行定义.

构造及析构函数说明

◆ Math()

eve::math::Math::Math ( )

Initializes RNG and math helpers.

在文件 Math.cpp 第 139 行定义.

◆ ~Math()

eve::math::Math::~Math ( )
overridedefault

Releases module state; caller-owned Vec/Mat pointers are not freed.

成员函数说明

◆ angle2()

float eve::math::Math::angle2 ( float  x,
float  y 
) const

Atan2 angle of (x,y) in radians.

在文件 Math.cpp 第 380 行定义.

引用了 x , 以及 y.

被这些函数引用 cartesianAngle().

◆ angleBetween2()

float eve::math::Math::angleBetween2 ( float  x1,
float  y1,
float  x2,
float  y2 
) const

Signed angle from first vector to second.

在文件 Math.cpp 第 382 行定义.

◆ approach()

float eve::math::Math::approach ( float  current,
float  target,
float  maxDelta 
) const

Moves current toward target by at most maxDelta.

在文件 Math.cpp 第 194 行定义.

引用了 current, d, sign() , 以及 target.

◆ bezierCubic()

float eve::math::Math::bezierCubic ( float  t,
float  p0,
float  p1,
float  p2,
float  p3 
) const

1D cubic Bezier at t in [0,1].

在文件 Math.cpp 第 795 行定义.

引用了 t , 以及 u.

被这些函数引用 bezierCubic2X() , 以及 bezierCubic2Y().

◆ bezierCubic2X()

float eve::math::Math::bezierCubic2X ( float  t,
float  x0,
float  y0,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
) const

X of a 2D cubic Bezier at t.

在文件 Math.cpp 第 813 行定义.

引用了 bezierCubic() , 以及 t.

◆ bezierCubic2Y()

float eve::math::Math::bezierCubic2Y ( float  t,
float  x0,
float  y0,
float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
) const

Y of a 2D cubic Bezier at t.

在文件 Math.cpp 第 818 行定义.

引用了 bezierCubic() , 以及 t.

◆ bezierQuadratic()

float eve::math::Math::bezierQuadratic ( float  t,
float  p0,
float  p1,
float  p2 
) const

1D quadratic Bezier at t in [0,1].

在文件 Math.cpp 第 789 行定义.

引用了 t , 以及 u.

被这些函数引用 bezierQuadratic2X() , 以及 bezierQuadratic2Y().

◆ bezierQuadratic2X()

float eve::math::Math::bezierQuadratic2X ( float  t,
float  x0,
float  y0,
float  x1,
float  y1,
float  x2,
float  y2 
) const

X of a 2D quadratic Bezier at t.

在文件 Math.cpp 第 803 行定义.

引用了 bezierQuadratic() , 以及 t.

◆ bezierQuadratic2Y()

float eve::math::Math::bezierQuadratic2Y ( float  t,
float  x0,
float  y0,
float  x1,
float  y1,
float  x2,
float  y2 
) const

Y of a 2D quadratic Bezier at t.

在文件 Math.cpp 第 808 行定义.

引用了 bezierQuadratic() , 以及 t.

◆ bias()

float eve::math::Math::bias ( float  t,
float  b 
) const

Schlick bias/gain — shape [0,1] distributions (procgen falloff).

在文件 Math.cpp 第 311 行定义.

引用了 b , 以及 t.

◆ bilinear()

float eve::math::Math::bilinear ( float  v00,
float  v10,
float  v01,
float  v11,
float  u,
float  v 
) const

Bilinear sample of 4 corners (v00,v10,v01,v11) with u,v in [0,1].

在文件 Math.cpp 第 643 行定义.

引用了 a, b, lerp(), u , 以及 v.

◆ boxesOverlap()

bool eve::math::Math::boxesOverlap ( float  minAx,
float  minAy,
float  minAz,
float  maxAx,
float  maxAy,
float  maxAz,
float  minBx,
float  minBy,
float  minBz,
float  maxBx,
float  maxBy,
float  maxBz 
) const

True if two AABBs overlap.

在文件 Math.cpp 第 570 行定义.

◆ cartesianAngle()

float eve::math::Math::cartesianAngle ( float  x,
float  y 
) const

Atan2 angle of (x,y).

在文件 Math.cpp 第 427 行定义.

引用了 angle2(), x , 以及 y.

◆ cartesianRadius()

float eve::math::Math::cartesianRadius ( float  x,
float  y 
) const

Length of (x,y).

在文件 Math.cpp 第 426 行定义.

引用了 length2(), x , 以及 y.

◆ circleRectOverlap()

bool eve::math::Math::circleRectOverlap ( float  cx,
float  cy,
float  radius,
float  rx,
float  ry,
float  rw,
float  rh 
) const

True if circle and axis-aligned rect overlap.

在文件 Math.cpp 第 450 行定义.

引用了 cx, cy, dx, dy , 以及 radius.

◆ circlesOverlap()

bool eve::math::Math::circlesOverlap ( float  x1,
float  y1,
float  r1,
float  x2,
float  y2,
float  r2 
) const

True if two circles overlap.

在文件 Math.cpp 第 438 行定义.

引用了 dx , 以及 dy.

◆ clamp()

float eve::math::Math::clamp ( float  x,
float  lo,
float  hi 
) const

Clamps x into [lo, hi].

在文件 Math.cpp 第 164 行定义.

引用了 x.

◆ closestPointOnSegment2X()

float eve::math::Math::closestPointOnSegment2X ( float  px,
float  py,
float  ax,
float  ay,
float  bx,
float  by 
) const

X of the closest point on segment AB to P.

在文件 Math.cpp 第 540 行定义.

引用了 ax, ay, bx, by, px, py , 以及 t.

◆ closestPointOnSegment2Y()

float eve::math::Math::closestPointOnSegment2Y ( float  px,
float  py,
float  ax,
float  ay,
float  bx,
float  by 
) const

Y of the closest point on segment AB to P.

在文件 Math.cpp 第 545 行定义.

引用了 ax, ay, bx, by, px, py , 以及 t.

◆ closestPointOnSegment3X()

float eve::math::Math::closestPointOnSegment3X ( float  px,
float  py,
float  pz,
float  ax,
float  ay,
float  az,
float  bx,
float  by,
float  bz 
) const

X of the closest point on segment AB to P.

在文件 Math.cpp 第 627 行定义.

引用了 ax, ay, az, bx, by, bz, px, py, pz , 以及 t.

◆ closestPointOnSegment3Y()

float eve::math::Math::closestPointOnSegment3Y ( float  px,
float  py,
float  pz,
float  ax,
float  ay,
float  az,
float  bx,
float  by,
float  bz 
) const

Y of the closest point on segment AB to P.

在文件 Math.cpp 第 632 行定义.

引用了 ax, ay, az, bx, by, bz, px, py, pz , 以及 t.

◆ closestPointOnSegment3Z()

float eve::math::Math::closestPointOnSegment3Z ( float  px,
float  py,
float  pz,
float  ax,
float  ay,
float  az,
float  bx,
float  by,
float  bz 
) const

Z of the closest point on segment AB to P.

在文件 Math.cpp 第 637 行定义.

引用了 ax, ay, az, bx, by, bz, px, py, pz , 以及 t.

◆ cross2()

float eve::math::Math::cross2 ( float  x1,
float  y1,
float  x2,
float  y2 
) const

2D cross product (scalar z-component).

在文件 Math.cpp 第 379 行定义.

◆ degToRad()

float eve::math::Math::degToRad ( float  deg) const

Degrees to radians.

在文件 Math.cpp 第 183 行定义.

引用了 M_PI.

◆ distance2()

float eve::math::Math::distance2 ( float  x1,
float  y1,
float  x2,
float  y2 
) const

2D distance between two points.

在文件 Math.cpp 第 366 行定义.

引用了 length2().

被这些函数引用 pointInCircle().

◆ distance3()

float eve::math::Math::distance3 ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
) const

3D distance between two points.

在文件 Math.cpp 第 370 行定义.

引用了 length3().

被这些函数引用 pointInSphere().

◆ dot2()

float eve::math::Math::dot2 ( float  x1,
float  y1,
float  x2,
float  y2 
) const

2D dot product of two vectors.

在文件 Math.cpp 第 374 行定义.

◆ dot3()

float eve::math::Math::dot3 ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
) const

3D dot product of two vectors.

在文件 Math.cpp 第 375 行定义.

◆ ease()

float eve::math::Math::ease ( float  t,
const std::string &  kind 
) const

Easing on [0,1]. kind: "linear"|"inQuad"|"outQuad"|"inOutQuad"|"inCubic"|"outCubic"|"inOutCubic"| "inSine"|"outSine"|"inOutSine"|"inExpo"|"outExpo"|"inOutExpo"

在文件 Math.cpp 第 324 行定义.

引用了 kind, M_PI , 以及 t.

◆ fbm2()

float eve::math::Math::fbm2 ( float  x,
float  y,
int  octaves = 4,
float  lacunarity = 2.f,
float  gain = 0.5f 
) const

Fractal Brownian Motion / ridged / turbulence. octaves >= 1; lacunarity ~2; gain/persistence ~0.5.

在文件 Math.cpp 第 700 行定义.

引用了 gain(), noise2(), x , 以及 y.

◆ fbm3()

float eve::math::Math::fbm3 ( float  x,
float  y,
float  z,
int  octaves = 4,
float  lacunarity = 2.f,
float  gain = 0.5f 
) const

3D fractal Brownian motion.

在文件 Math.cpp 第 713 行定义.

引用了 gain(), noise3(), x, y , 以及 z.

◆ fract()

float eve::math::Math::fract ( float  x) const

Fractional part of x.

在文件 Math.cpp 第 192 行定义.

引用了 x.

◆ gain()

float eve::math::Math::gain ( float  t,
float  g 
) const

Schlick gain shaping of t in [0,1].

在文件 Math.cpp 第 318 行定义.

引用了 bias, g , 以及 t.

被这些函数引用 fbm2(), fbm3(), ridged2(), ridged3() , 以及 turbulence2().

◆ getRandomSeed()

uint32_t eve::math::Math::getRandomSeed ( ) const

Current RNG seed value.

在文件 Math.cpp 第 661 行定义.

◆ hash1()

float eve::math::Math::hash1 ( float  x) const

Deterministic 1D hash mapped to [0,1].

在文件 Math.cpp 第 685 行定义.

引用了 x.

◆ hash2()

float eve::math::Math::hash2 ( float  x,
float  y 
) const

Deterministic 2D hash mapped to [0,1].

在文件 Math.cpp 第 686 行定义.

引用了 x , 以及 y.

◆ hash3()

float eve::math::Math::hash3 ( float  x,
float  y,
float  z 
) const

Deterministic 3D hash mapped to [0,1].

在文件 Math.cpp 第 687 行定义.

引用了 x, y , 以及 z.

◆ inverseLerp()

float eve::math::Math::inverseLerp ( float  a,
float  b,
float  x 
) const

Linear interpolation between a and b by t.

Inverse of lerp: t such that lerp(a,b,t) ≈ x.

在文件 Math.cpp 第 300 行定义.

引用了 a, b , 以及 x.

◆ length2()

float eve::math::Math::length2 ( float  x,
float  y 
) const

2D vector length from components.

在文件 Math.cpp 第 361 行定义.

引用了 x , 以及 y.

被这些函数引用 cartesianRadius(), distance2(), normalize2X() , 以及 normalize2Y().

◆ length3()

float eve::math::Math::length3 ( float  x,
float  y,
float  z 
) const

3D vector length from components.

在文件 Math.cpp 第 362 行定义.

引用了 x, y , 以及 z.

被这些函数引用 distance3(), normalize3X(), normalize3Y() , 以及 normalize3Z().

◆ lerp()

float eve::math::Math::lerp ( float  a,
float  b,
float  t 
) const

Linear interpolation between a and b by t.

在文件 Math.cpp 第 169 行定义.

引用了 a, b , 以及 t.

被这些函数引用 bilinear().

◆ lerpAngle()

float eve::math::Math::lerpAngle ( float  a,
float  b,
float  t 
) const

Shortest-path angle interpolation.

在文件 Math.cpp 第 386 行定义.

引用了 a, b, M_PI , 以及 t.

◆ Module_REG()

eve::math::Math::Module_REG ( Math  )

◆ newMat4()

Mat4 * eve::math::Math::newMat4 ( )

Allocates an identity Mat4. @ownership Caller deletes.

在文件 Math.cpp 第 144 行定义.

◆ newMat4RotationZ()

Mat4 * eve::math::Math::newMat4RotationZ ( float  radians)

Allocates a Z-rotation Mat4 (radians). @ownership Caller deletes.

在文件 Math.cpp 第 158 行定义.

引用了 m.

◆ newMat4Scale()

Mat4 * eve::math::Math::newMat4Scale ( float  sx,
float  sy,
float  sz 
)

Allocates a scale Mat4. @ownership Caller deletes.

在文件 Math.cpp 第 152 行定义.

引用了 m, sx, sy , 以及 sz.

◆ newMat4Translation()

Mat4 * eve::math::Math::newMat4Translation ( float  x,
float  y,
float  z 
)

Allocates a translation Mat4. @ownership Caller deletes.

在文件 Math.cpp 第 146 行定义.

引用了 m, x, y , 以及 z.

◆ newVec2()

Vec2 * eve::math::Math::newVec2 ( float  x = 0.f,
float  y = 0.f 
)

Allocates a Vec2. @ownership Caller deletes.

在文件 Math.cpp 第 141 行定义.

引用了 x , 以及 y.

◆ newVec3()

Vec3 * eve::math::Math::newVec3 ( float  x = 0.f,
float  y = 0.f,
float  z = 0.f 
)

Allocates a Vec3. @ownership Caller deletes.

在文件 Math.cpp 第 142 行定义.

引用了 x, y , 以及 z.

◆ noise1()

float eve::math::Math::noise1 ( float  x) const

Value noise in 1D, range [0,1].

在文件 Math.cpp 第 689 行定义.

引用了 x.

◆ noise2()

float eve::math::Math::noise2 ( float  x,
float  y 
) const

Value noise in 2D, range [0,1].

在文件 Math.cpp 第 690 行定义.

引用了 x , 以及 y.

被这些函数引用 fbm2(), ridged2(), turbulence2() , 以及 warpNoise2().

◆ noise3()

float eve::math::Math::noise3 ( float  x,
float  y,
float  z 
) const

Value noise in 3D, range [0,1].

在文件 Math.cpp 第 691 行定义.

引用了 x, y , 以及 z.

被这些函数引用 fbm3() , 以及 ridged3().

◆ normalize2X()

float eve::math::Math::normalize2X ( float  x,
float  y 
) const

X of the normalized 2D vector (zero-safe).

在文件 Math.cpp 第 394 行定义.

引用了 length2(), x , 以及 y.

◆ normalize2Y()

float eve::math::Math::normalize2Y ( float  x,
float  y 
) const

Y of the normalized 2D vector (zero-safe).

在文件 Math.cpp 第 398 行定义.

引用了 length2(), x , 以及 y.

◆ normalize3X()

float eve::math::Math::normalize3X ( float  x,
float  y,
float  z 
) const

X of the normalized 3D vector (zero-safe).

在文件 Math.cpp 第 402 行定义.

引用了 length3(), x, y , 以及 z.

◆ normalize3Y()

float eve::math::Math::normalize3Y ( float  x,
float  y,
float  z 
) const

Y of the normalized 3D vector (zero-safe).

在文件 Math.cpp 第 406 行定义.

引用了 length3(), x, y , 以及 z.

◆ normalize3Z()

float eve::math::Math::normalize3Z ( float  x,
float  y,
float  z 
) const

Z of the normalized 3D vector (zero-safe).

在文件 Math.cpp 第 410 行定义.

引用了 length3(), x, y , 以及 z.

◆ perlin2()

float eve::math::Math::perlin2 ( float  x,
float  y 
) const

Perlin noise in 2D, range [0,1].

在文件 Math.cpp 第 695 行定义.

引用了 x , 以及 y.

◆ perlin3()

float eve::math::Math::perlin3 ( float  x,
float  y,
float  z 
) const

Perlin noise in 3D, range [0,1].

在文件 Math.cpp 第 696 行定义.

引用了 x, y , 以及 z.

◆ pingPong()

float eve::math::Math::pingPong ( float  t,
float  length 
) const

Triangle-wave ping-pong of t over [0, length].

在文件 Math.cpp 第 209 行定义.

引用了 length, t , 以及 wrap().

◆ pointInBox()

bool eve::math::Math::pointInBox ( float  px,
float  py,
float  pz,
float  minX,
float  minY,
float  minZ,
float  maxX,
float  maxY,
float  maxZ 
) const

Inclusive AABB test against [min,max] on each axis.

在文件 Math.cpp 第 557 行定义.

引用了 px , 以及 pz.

◆ pointInCircle()

bool eve::math::Math::pointInCircle ( float  px,
float  py,
float  cx,
float  cy,
float  radius 
) const

True if point is inside or on the circle.

在文件 Math.cpp 第 429 行定义.

引用了 cx, cy, distance2(), px, py , 以及 radius.

◆ pointInRect()

bool eve::math::Math::pointInRect ( float  px,
float  py,
float  rx,
float  ry,
float  rw,
float  rh 
) const

True if point is inside or on the axis-aligned rect.

在文件 Math.cpp 第 434 行定义.

引用了 px , 以及 py.

◆ pointInSphere()

bool eve::math::Math::pointInSphere ( float  px,
float  py,
float  pz,
float  cx,
float  cy,
float  cz,
float  radius 
) const

True if point is inside or on the sphere.

在文件 Math.cpp 第 551 行定义.

引用了 cx, cy, distance3(), px, py, pz , 以及 radius.

◆ polarX()

float eve::math::Math::polarX ( float  radius,
float  radians 
) const

X of polar (radius, radians).

在文件 Math.cpp 第 424 行定义.

引用了 radius.

◆ polarY()

float eve::math::Math::polarY ( float  radius,
float  radians 
) const

Y of polar (radius, radians).

在文件 Math.cpp 第 425 行定义.

引用了 radius.

◆ quantize()

float eve::math::Math::quantize ( float  x,
float  stepSize 
) const

Quantizes x to multiples of stepSize.

在文件 Math.cpp 第 351 行定义.

引用了 x.

◆ radToDeg()

float eve::math::Math::radToDeg ( float  rad) const

Radians to degrees.

在文件 Math.cpp 第 184 行定义.

引用了 M_PI.

◆ random()

float eve::math::Math::random ( )

Uniform float in [0, 1).

在文件 Math.cpp 第 663 行定义.

◆ randomGaussian()

float eve::math::Math::randomGaussian ( float  mean,
float  stddev 
)

Box-Muller Gaussian (mean, stddev).

在文件 Math.cpp 第 680 行定义.

◆ randomInt()

int eve::math::Math::randomInt ( int  min,
int  maxInclusive 
)

Uniform inclusive integer in [min, maxInclusive].

在文件 Math.cpp 第 674 行定义.

引用了 min.

◆ randomRange()

float eve::math::Math::randomRange ( float  min,
float  max 
)

Uniform float in [min, max).

在文件 Math.cpp 第 668 行定义.

引用了 max , 以及 min.

◆ raycastBox()

float eve::math::Math::raycastBox ( float  ox,
float  oy,
float  oz,
float  dx,
float  dy,
float  dz,
float  minX,
float  minY,
float  minZ,
float  maxX,
float  maxY,
float  maxZ 
) const

Ray vs AABB; parametric t >= 0 on hit, else -1.

在文件 Math.cpp 第 595 行定义.

引用了 d, dx, dy, dz, ox , 以及 oy.

◆ raycastCircle2()

float eve::math::Math::raycastCircle2 ( float  ox,
float  oy,
float  dx,
float  dy,
float  cx,
float  cy,
float  radius 
) const

Ray vs circle. Hit point = (ox,oy) + t*(dx,dy). Returns t >= 0 on hit, else -1. Direction need not be unit; for a segment use dir = B-A and accept t in [0,1].

在文件 Math.cpp 第 481 行定义.

引用了 a, b, c, cx, cy, dx, dy, ox, oy, radius , 以及 s.

◆ raycastPlane()

float eve::math::Math::raycastPlane ( float  ox,
float  oy,
float  oz,
float  dx,
float  dy,
float  dz,
float  px,
float  py,
float  pz,
float  nx,
float  ny,
float  nz 
) const

Ray vs infinite plane through (px,py,pz) with normal (nx,ny,nz). Returns parametric t, or -1 if parallel / behind ray origin.

在文件 Math.cpp 第 619 行定义.

引用了 dx, dy, dz, nx, ny, nz, ox, oy, px, py, pz , 以及 t.

◆ raycastRect2()

float eve::math::Math::raycastRect2 ( float  ox,
float  oy,
float  dx,
float  dy,
float  rx,
float  ry,
float  rw,
float  rh 
) const

Ray vs axis-aligned rect (x,y,w,h). Returns parametric t >= 0, else -1.

在文件 Math.cpp 第 499 行定义.

引用了 d, dx, dy, ox , 以及 oy.

◆ raycastSphere()

float eve::math::Math::raycastSphere ( float  ox,
float  oy,
float  oz,
float  dx,
float  dy,
float  dz,
float  cx,
float  cy,
float  cz,
float  radius 
) const

Ray vs sphere; parametric t >= 0 on hit, else -1.

在文件 Math.cpp 第 577 行定义.

引用了 a, b, c, cx, cy, dx, dy, dz, ox, oy, radius , 以及 s.

◆ rectsOverlap()

bool eve::math::Math::rectsOverlap ( float  x1,
float  y1,
float  w1,
float  h1,
float  x2,
float  y2,
float  w2,
float  h2 
) const

True if two axis-aligned rects overlap.

在文件 Math.cpp 第 445 行定义.

◆ remap()

float eve::math::Math::remap ( float  x,
float  inMin,
float  inMax,
float  outMin,
float  outMax 
) const

Maps x from [inMin,inMax] into [outMin,outMax].

在文件 Math.cpp 第 177 行定义.

引用了 t , 以及 x.

◆ ridged2()

float eve::math::Math::ridged2 ( float  x,
float  y,
int  octaves = 4,
float  lacunarity = 2.f,
float  gain = 0.5f 
) const

2D ridged multifractal noise.

在文件 Math.cpp 第 726 行定义.

引用了 gain(), n, noise2(), x , 以及 y.

◆ ridged3()

float eve::math::Math::ridged3 ( float  x,
float  y,
float  z,
int  octaves = 4,
float  lacunarity = 2.f,
float  gain = 0.5f 
) const

3D ridged multifractal noise.

在文件 Math.cpp 第 742 行定义.

引用了 gain(), n, noise3(), x, y , 以及 z.

◆ rotate2X()

float eve::math::Math::rotate2X ( float  x,
float  y,
float  radians 
) const

Rotate (x,y) by radians around origin.

在文件 Math.cpp 第 415 行定义.

引用了 c, s, x , 以及 y.

◆ rotate2Y()

float eve::math::Math::rotate2Y ( float  x,
float  y,
float  radians 
) const

Y after rotating (x,y) by radians about the origin.

在文件 Math.cpp 第 419 行定义.

引用了 c, s, x , 以及 y.

◆ segmentsIntersect()

bool eve::math::Math::segmentsIntersect ( float  ax,
float  ay,
float  bx,
float  by,
float  cx,
float  cy,
float  dx,
float  dy 
) const

True if segments AB and CD intersect (including endpoints).

在文件 Math.cpp 第 459 行定义.

引用了 ax, ay, bx, by, cx, cy, dx, dy, px, py, qx , 以及 qy.

◆ setRandomSeed()

void eve::math::Math::setRandomSeed ( uint32_t  seed)

Sets the module RNG seed.

在文件 Math.cpp 第 649 行定义.

引用了 seed.

被这些函数引用 setRandomSeedFromTime().

◆ setRandomSeedFromTime()

void eve::math::Math::setRandomSeedFromTime ( )

Seeds the RNG from the system clock.

在文件 Math.cpp 第 654 行定义.

引用了 setRandomSeed().

◆ sign()

float eve::math::Math::sign ( float  x) const

Sign of x (-1, 0, or 1).

在文件 Math.cpp 第 186 行定义.

引用了 x.

被这些函数引用 approach().

◆ smootherstep()

float eve::math::Math::smootherstep ( float  edge0,
float  edge1,
float  x 
) const

Ken Perlin smootherstep between edge0 and edge1.

在文件 Math.cpp 第 305 行定义.

引用了 t , 以及 x.

◆ smoothstep()

float eve::math::Math::smoothstep ( float  edge0,
float  edge1,
float  x 
) const

Hermite smoothstep between edge0 and edge1.

在文件 Math.cpp 第 171 行定义.

引用了 t , 以及 x.

◆ snap()

float eve::math::Math::snap ( float  x,
float  grid 
) const

Snaps x to the nearest grid multiple.

在文件 Math.cpp 第 356 行定义.

引用了 x.

◆ spheresOverlap()

bool eve::math::Math::spheresOverlap ( float  x1,
float  y1,
float  z1,
float  r1,
float  x2,
float  y2,
float  z2,
float  r2 
) const

True if two spheres overlap.

在文件 Math.cpp 第 562 行定义.

引用了 dx, dy , 以及 dz.

◆ steeringArrive2()

Vec2 * eve::math::Math::steeringArrive2 ( float  x,
float  y,
float  targetX,
float  targetY,
float  maxSpeed,
float  slowRadius,
float  stopRadius 
) const

Creates a 2D arrive velocity. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 239 行定义.

引用了 eve::math::steering::arrive(), targetX, value, x , 以及 y.

◆ steeringArrive3()

Vec3 * eve::math::Math::steeringArrive3 ( float  x,
float  y,
float  z,
float  targetX,
float  targetY,
float  targetZ,
float  maxSpeed,
float  slowRadius,
float  stopRadius 
) const

Creates a 3D arrive velocity. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 247 行定义.

引用了 eve::math::steering::arrive(), targetX, value, x, y , 以及 z.

◆ steeringAvoid2()

Vec2 * eve::math::Math::steeringAvoid2 ( float  x,
float  y,
float  velocityX,
float  velocityY,
float  obstacleX,
float  obstacleY,
float  obstacleRadius,
float  lookAhead,
float  maxAcceleration 
) const

Creates 2D avoidance acceleration. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 281 行定义.

引用了 eve::math::steering::avoid(), value, x , 以及 y.

◆ steeringAvoid3()

Vec3 * eve::math::Math::steeringAvoid3 ( float  x,
float  y,
float  z,
float  velocityX,
float  velocityY,
float  velocityZ,
float  obstacleX,
float  obstacleY,
float  obstacleZ,
float  obstacleRadius,
float  lookAhead,
float  maxAcceleration 
) const

Creates 3D avoidance acceleration. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 291 行定义.

引用了 eve::math::steering::avoid(), value, x, y , 以及 z.

◆ steeringFlee2()

Vec2 * eve::math::Math::steeringFlee2 ( float  x,
float  y,
float  targetX,
float  targetY,
float  maxSpeed 
) const

Creates a 2D flee velocity. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 227 行定义.

引用了 eve::math::steering::flee(), targetX, value, x , 以及 y.

◆ steeringFlee3()

Vec3 * eve::math::Math::steeringFlee3 ( float  x,
float  y,
float  z,
float  targetX,
float  targetY,
float  targetZ,
float  maxSpeed 
) const

Creates a 3D flee velocity. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 233 行定义.

引用了 eve::math::steering::flee(), targetX, value, x, y , 以及 z.

◆ steeringPathTarget2()

int eve::math::Math::steeringPathTarget2 ( float  x,
float  y,
const std::string &  points,
int  current,
float  tolerance 
) const

Selects a 2D path point from CSV x:y points, or -1 for no valid points.

在文件 Math.cpp 第 269 行定义.

引用了 current, eve::math::steering::pathTarget(), points, x , 以及 y.

◆ steeringPathTarget3()

int eve::math::Math::steeringPathTarget3 ( float  x,
float  y,
float  z,
const std::string &  points,
int  current,
float  tolerance 
) const

Selects a 3D path point from CSV x:y:z points, or -1 for no valid points.

在文件 Math.cpp 第 275 行定义.

引用了 current, eve::math::steering::pathTarget(), points, x, y , 以及 z.

◆ steeringSeek2()

Vec2 * eve::math::Math::steeringSeek2 ( float  x,
float  y,
float  targetX,
float  targetY,
float  maxSpeed 
) const

Creates a 2D seek velocity. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 215 行定义.

引用了 eve::math::steering::seek(), targetX, value, x , 以及 y.

◆ steeringSeek3()

Vec3 * eve::math::Math::steeringSeek3 ( float  x,
float  y,
float  z,
float  targetX,
float  targetY,
float  targetZ,
float  maxSpeed 
) const

Creates a 3D seek velocity. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 221 行定义.

引用了 eve::math::steering::seek(), targetX, value, x, y , 以及 z.

◆ steeringSeparation2()

Vec2 * eve::math::Math::steeringSeparation2 ( float  x,
float  y,
const std::string &  neighbors,
float  radius,
float  maxAcceleration 
) const

Creates 2D separation acceleration from CSV. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 254 行定义.

引用了 radius, eve::math::steering::separation(), value, x , 以及 y.

◆ steeringSeparation3()

Vec3 * eve::math::Math::steeringSeparation3 ( float  x,
float  y,
float  z,
const std::string &  neighbors,
float  radius,
float  maxAcceleration 
) const

Creates 3D separation acceleration from CSV. @ownership owned @lifetime Caller deletes the result.

在文件 Math.cpp 第 262 行定义.

引用了 radius, eve::math::steering::separation(), value, x, y , 以及 z.

◆ step()

float eve::math::Math::step ( float  edge,
float  x 
) const

Heaviside step: 0 if x < edge else 1.

在文件 Math.cpp 第 349 行定义.

引用了 edge , 以及 x.

◆ turbulence2()

float eve::math::Math::turbulence2 ( float  x,
float  y,
int  octaves = 4,
float  lacunarity = 2.f,
float  gain = 0.5f 
) const

2D turbulence (absolute fBm).

在文件 Math.cpp 第 758 行定义.

引用了 gain(), noise2(), x , 以及 y.

◆ voronoi2()

float eve::math::Math::voronoi2 ( float  x,
float  y 
) const

Worley / Voronoi F1 distance in [0, ~1.5] (cell size 1). voronoiEdge2 = F2 - F1 (cell borders).

在文件 Math.cpp 第 771 行定义.

引用了 x , 以及 y.

◆ voronoiEdge2()

float eve::math::Math::voronoiEdge2 ( float  x,
float  y 
) const

2D Worley F2-F1 edge distance.

在文件 Math.cpp 第 777 行定义.

引用了 x , 以及 y.

◆ warpNoise2()

float eve::math::Math::warpNoise2 ( float  x,
float  y,
float  warpAmp = 1.f 
) const

Domain warp: sample noise at (x,y) + warpAmp * (noise-0.5). Useful for organic terrain / caves.

在文件 Math.cpp 第 783 行定义.

引用了 noise2(), wx, wy, x , 以及 y.

◆ wrap()

float eve::math::Math::wrap ( float  x,
float  lo,
float  hi 
) const

Wraps x into [lo, hi).

在文件 Math.cpp 第 200 行定义.

引用了 range, t , 以及 x.

被这些函数引用 pingPong().


该类的文档由以下文件生成: