Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
 Summary Activity SCM

SCM Repository

[sml3d] View of /trunk/sml3d/src/geometry/transform-sig.sml
 [sml3d] / trunk / sml3d / src / geometry / transform-sig.sml View of /trunk/sml3d/src/geometry/transform-sig.sml

Wed Mar 17 21:00:52 2010 UTC (9 years, 7 months ago) by jhr
File size: 1385 byte(s)
Working on geometry library
(* transform-sig.sml
*
* COPYRIGHT (c) 2010 John Reppy (http://cs.uchicago.edu/~jhr)
*
* Specialized support for common affine matrices; by tracking the
* shape of the matrices, we get faster transforms and inverses.
*)

signature TRANSFORM3 =
sig

type transform

type flt
type vec3 = {x : flt, y : flt, z : flt}
type vec4 = {x : flt, y : flt, z : flt, w : flt}
type mat4

exception ZeroScale

(* basic transformations *)
val identity : transform
val translate : vec3 -> transform
val uScale : flt -> transform
val scale : vec3 -> transform
val rotateX : flt -> transform
val rotateY : flt -> transform
val rotateZ : flt -> transform
val rotate : vec3 * flt -> transform

(* modify an existing transform *)
val concat : transform * transform -> transform
val transpose : transform -> transform
val inverse : transform -> transform

(* apply a transform to an R3 point *)
val xformPt : transform -> vec3 -> vec3

(* apply a transform to an R3 vector *)
val xformVec : transvorm -> vec3 -> vec3

(* apply a transform to an R3 normal vector *)
val xformNorm : transform -> vec3 -> vec3

(* apply a transform to an R4 vector *)
val xformVec4 : transform -> vec4 -> vec4

(* extract the 4x4 matrix for a transform *)
val matrix : transform -> mat4

end

 root@smlnj-gforge.cs.uchicago.edu ViewVC Help Powered by ViewVC 1.0.0