Skip to content
Caste edited this page Sep 13, 2010 · 2 revisions

Kazmath

Here’s a list of features Kazmath should have and how they’re named, what they are doing..

kmVec2


struct kmVec2{
   kmScalar x,y;
}
  • length(kmVec2) → kmScalar
  • lengthSq(kmVec2) → kmScalar
  • normalize(kmVec2&)
  • add(kmVec2, kmVec2) → kmVec2
  • sub(kmVec2, kmVec2) → kmVec2
  • dot(kmVec2, kmVec2) → kmScalar
  • scale(kmVec2&, kmScalar)
  • equal(kmVec2, kmVec2) →bool
  • transform(kmVec2, kmMat3) → kmVec2

kmVec3


struct kmVec3{
   kmScalar x,y,z;
}
  • length(kmVec3) → kmScalar
  • lengthSq(kmVec3) → kmScalar
  • normalize(kmVec3&)
  • add(kmVec3, kmVec3) → kmVec3
  • sub(kmVec3, kmVec3) → kmVec3
  • dot(kmVec3, kmVec3) → kmScalar
  • cross(kmVec3, kmVec3) → kmVec3
  • scale(kmVec3&, kmScalar)
  • equal(kmVec3, kmVec3) →bool
  • transform(kmVec3, kmMat4) → kmVec3
  • inverseTransform(kmVec3, kmMat4) → kmVec3 Means that we’re transforming with the inverse matrix here

kmVec4


struct kmVec4{
   kmScalar x,y,z,w;
}
  • length(kmVec4) → kmScalar
  • lengthSq(kmVec4) → kmScalar
  • normalize(kmVec4&)
  • add(kmVec4, kmVec4) → kmVec4
  • sub(kmVec4, kmVec4) → kmVec4
  • dot(kmVec4, kmVec4) → kmScalar
  • scale(kmVec4&, kmScalar)
  • equal(kmVec4, kmVec3) →bool
  • transform(kmVec4, kmMat4) → kmVec4
  • inverseTransform(kmVec4, kmMat4) → kmVec4 Means that we’re transforming with the inverse matrix here
  • getVec3(kmVec4) → kmVec3 scales the weight of the homogenous coordinate back to 1

kmMat3


struct kmMat3{
   kmScalar m_Mat[9];
}
  • identity(kmMat3&)
  • mult(kmMat3, kmScalar) → kmMat3 component-wise
  • mult(kmMat3, kmMat3) → kmMat3
  • add(kmMat3, kmMat3) → kmMat3 component-wise
  • sub(kmMat3, kmMat3) → kmMat3 component-wise
  • transpose(kmMat3) → kmMat3
  • inverse(kmMat3) → kmMat3
  • determinant(kmMat3) → kmScalar
  • rotation(kmScalar) → kmMat3 rotates around the center
  • scale(kmVec2) → kmMat3
  • scale(kmScalar) → kmMat3
  • translate(kmVec2) → kmMat3

kmMat4


struct kmMat4{
   kmScalar m_Mat[16];
}
  • identity(kmMat4&)
  • mult(kmMat4, kmScalar) → kmMat4 component-wise
  • mult(kmMat4, kmMat4) → kmMat4
  • add(kmMat4, kmMat4) → kmMat4 component-wise
  • sub(kmMat4, kmMat4) → kmMat4 component-wise
  • transpose(kmMat4) → kmMat4
  • inverse(kmMat4) → kmMat4
  • determinant(kmMat4) → kmScalar
  • rotation{X,Y,Z}(kmScalar) → kmMat4
  • rotationAxis(kmVec3, kmScalar) → kmMat4
  • rotationQuaternion(kmQuaternion) → kmMat4
  • pitchYawRoll(kmScalar, kmScalar, kmScalar) → kmMat4
  • scale(kmVec3) → kmMat4
  • scale(kmScalar) → kmMat4
  • translate(kmVec3) → kmMat4

kmQuaternion


struct kmVec4{
   kmScalar x,y,z,w;
}

kmPlane


struct kmPlane{
   kmScalar a,b,c,d;
}
  • dot(kmPlane, kmVec4) → kmScalar
  • dot(kmPlane, kmVec3) → kmScalar
  • createPlane(kmVec3 point, kmVec3 normal) → kmPlane create a plane with the given normal going through “point”
  • createPlane(kmVec3 p1, kmVec3 p2, kmVec3 p3) → kmPlane Create the plane described by the 3 points
  • distance(kmPlane, kmVec3) → kmScalar
  • intersectLine(kmPlane, kmVec3, kmVec3) → kmVec3 Calculate the point of intersection between the plane and the line through the 2 points, NULL if there is non (plane and line are parallel)
  • normalize(kmPlane&)
  • transform(kmPlane, kmMat4) → kmPlane
Clone this wiki locally