# Banate CAD Core

**Class**

inheritsFrom(baseClass)

functor(objstate, func)

functorcall(func, params)

**LinearAlgebra**

The Linear Algebra module contains a few simple classes and routines to facilitate the performance of linear algebra functions. The two basic classes contained here are the vector, and the matrix. The ‘vec’ class can be used to construct vector objects of any length. It is primarily used to create vec2, vec3, and vec4 objects though. Although the vec class does have basic low level operations such as dot and cross product, there are not a lot of other frills here. The glsl module puts a nice skin over the base vec class, and provides some very useful functions.

vec.new(params)

vec.add(a,b)

vec.sub(a,b)

vec.mults(v,s)

vec.mul(a, b)

vec.div(a, b)

vec.length(x)

vec.tostring(vec)

**Maths**

The Maths module is a catch all for numerous helpful math routines and types. It contains items such as cubic curve evaluation, spherical coordinates, transforms and vectors. The various vector and transform functions will be moving to the LinearAlgebra module.

radians(degrees)

clean(n)

sph_to_cart(s)

sph_from_cart(c)

sphu_from_cart(c, rad)

sph_dist(c1, c2)

safediv(n, d)

**trimesh**

The triangle mesh is a core component of the graphics system. Most of the shapes eventually turn into mesh objects for easy rendering. In addition to being core to most shapes, they are also core to being able to perform CSG operations.

trimesh:new(params)

trimesh.addvertex(self, v)

trimesh.addvertices(self, verts)

trimesh.addface(self, face)

trimesh.addedge(v1, v2, f1, f2)