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

# SCM Repository

[sml3d] Diff of /src/common/vec3f.sml
 [sml3d] / src / common / vec3f.sml

# Diff of /src/common/vec3f.sml

revision 13, Thu Nov 15 05:22:12 2007 UTC revision 14, Sat Feb 16 22:59:07 2008 UTC
# Line 26  Line 26
26      val vector : vec3f -> vec4f      val vector : vec3f -> vec4f
27      val point : vec3f -> vec4f      val point : vec3f -> vec4f
28
29        val nth : vec3f * int -> float
30
31      val zero : vec3f      val zero : vec3f
32
33    (* standard basis vectors *)    (* standard basis vectors *)
# Line 71  Line 73
73
74      type float = FP.float      type float = FP.float
75
76      val epsilon : float = 1.0e~6      val epsilon : float = 1.0e~5

type vec3f = {x : float, y : float, z : float}
77
78      type vec4f = {x : float, y : float, z : float, w : float}      type vec3f = float Vec3.vec3
79        type vec4f = float Vec4.vec4
80
81      open Vec3      open Vec3
82
# Line 129  Line 130
130            val l = length v            val l = length v
131            in            in
132              if (l < epsilon)              if (l < epsilon)
133                then (l, scale(1.0 / l, v))                then (l, v)
134                else (l, v)                else (l, scale(1.0 / l, v))
135            end            end
136
137      fun normalize v = #2(lengthAndDir v)      fun normalize v = #2(lengthAndDir v)

Legend:
 Removed from v.13 changed lines Added in v.14