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/triangle3-sig.sml
 [sml3d] / trunk / sml3d / src / geometry / triangle3-sig.sml

# View of /trunk/sml3d/src/geometry/triangle3-sig.sml

Revision 766 - (download) (annotate)
Sun Feb 14 16:48:43 2010 UTC (9 years, 8 months ago) by jhr
File size: 974 byte(s)
```  Added triangle modules
```
```(* triangle3-sig.sml
*
* COPYRIGHT (c) 2010 John Reppy (http://cs.uchicago.edu/~jhr)
* All rights reserved.
*
* The interface to 3D triangles.
*)

signature TRIANGLE3 =
sig

type flt
type vec = {x : flt, y : flt, z : flt}

(* we assume CCW winding, which is the standard for a RHS
* coordinate system.
*)
type tri = {v1 : vec, v2 : vec, v3 : vec}

(* flip the triangle (i.e., reverse the order of its vertices *)
val flip : tri -> tri

(* return the triangle's normal vector (the zero vector
* if it is degenerate.
*)
val normal : tri -> vec

(* map barycentric coordinates to a point *)
val barycentricCoords : tri -> {alpha : flt, beta : flt} -> vec3

(* return the plane defined by a triangle *)
val toPlane : tri -> flt GTypes.plane

(* iterators *)
val app : (vec -> unit) -> tri -> unit
val map : (vec -> 'a) -> tri -> 'a GTypes.tri

(* string conversion *)
val toString : tri -> string

end
```

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