Skip to content

Commit 82dc3c7

Browse files
committed
moved glm funcs to namespace
1 parent e816ccd commit 82dc3c7

5 files changed

Lines changed: 582 additions & 579 deletions

File tree

Sources/Complex.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,17 @@ public struct Complex<T:FloatingPointArithmeticType> : MatrixType, FloatLiteralC
115115

116116
// Init from polar components
117117
public init(rho:T, theta:T) {
118-
self.real = rho * SGLMath.GLcos(theta)
119-
self.imag = rho * SGLMath.GLsin(theta)
118+
self.real = rho * SGLMath.SGLcos(theta)
119+
self.imag = rho * SGLMath.SGLsin(theta)
120120

121121
}
122122

123123
public var abs:T {
124-
return SGLMath.GLsqrt(real * real + imag * imag)
124+
return SGLMath.SGLsqrt(real * real + imag * imag)
125125
}
126126

127127
public var arg:T {
128-
return SGLMath.GLatan(imag, real)
128+
return SGLMath.SGLatan(imag, real)
129129
}
130130

131131
public var norm:T {

Sources/Internal.swift

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public final class SGLMath {
106106
}
107107
}
108108

109-
public static func GLsin<T:FloatingPointArithmeticType>(angle:T) -> T {
109+
public static func SGLsin<T:FloatingPointArithmeticType>(angle:T) -> T {
110110
if let z = angle as? Double {
111111
return sin(z) as! T
112112
}
@@ -116,7 +116,7 @@ public final class SGLMath {
116116
preconditionFailure()
117117
}
118118

119-
public static func GLcos<T:FloatingPointArithmeticType>(angle:T) -> T {
119+
public static func SGLcos<T:FloatingPointArithmeticType>(angle:T) -> T {
120120
if let z = angle as? Double {
121121
return cos(z) as! T
122122
}
@@ -126,7 +126,7 @@ public final class SGLMath {
126126
preconditionFailure()
127127
}
128128

129-
public static func GLtan<T:FloatingPointArithmeticType>(angle:T) -> T {
129+
public static func SGLtan<T:FloatingPointArithmeticType>(angle:T) -> T {
130130
if let z = angle as? Double {
131131
return tan(z) as! T
132132
}
@@ -136,7 +136,7 @@ public final class SGLMath {
136136
preconditionFailure()
137137
}
138138

139-
public static func GLasin<T:FloatingPointArithmeticType>(x:T) -> T {
139+
public static func SGLasin<T:FloatingPointArithmeticType>(x:T) -> T {
140140
if let z = x as? Double {
141141
return asin(z) as! T
142142
}
@@ -146,7 +146,7 @@ public final class SGLMath {
146146
preconditionFailure()
147147
}
148148

149-
public static func GLacos<T:FloatingPointArithmeticType>(x:T) -> T {
149+
public static func SGLacos<T:FloatingPointArithmeticType>(x:T) -> T {
150150
if let z = x as? Double {
151151
return acos(z) as! T
152152
}
@@ -156,7 +156,7 @@ public final class SGLMath {
156156
preconditionFailure()
157157
}
158158

159-
public static func GLatan<T:FloatingPointArithmeticType>(y:T, _ x:T) -> T {
159+
public static func SGLatan<T:FloatingPointArithmeticType>(y:T, _ x:T) -> T {
160160
if let z = y as? Double {
161161
return atan2(z, x as! Double) as! T
162162
}
@@ -166,7 +166,7 @@ public final class SGLMath {
166166
preconditionFailure()
167167
}
168168

169-
public static func GLatan<T:FloatingPointArithmeticType>(yoverx:T) -> T {
169+
public static func SGLatan<T:FloatingPointArithmeticType>(yoverx:T) -> T {
170170
if let z = yoverx as? Double {
171171
return atan(z) as! T
172172
}
@@ -176,7 +176,7 @@ public final class SGLMath {
176176
preconditionFailure()
177177
}
178178

179-
public static func GLsinh<T:FloatingPointArithmeticType>(x:T) -> T {
179+
public static func SGLsinh<T:FloatingPointArithmeticType>(x:T) -> T {
180180
if let z = x as? Double {
181181
return sinh(z) as! T
182182
}
@@ -186,7 +186,7 @@ public final class SGLMath {
186186
preconditionFailure()
187187
}
188188

189-
public static func GLcosh<T:FloatingPointArithmeticType>(x:T) -> T {
189+
public static func SGLcosh<T:FloatingPointArithmeticType>(x:T) -> T {
190190
if let z = x as? Double {
191191
return cosh(z) as! T
192192
}
@@ -196,7 +196,7 @@ public final class SGLMath {
196196
preconditionFailure()
197197
}
198198

199-
public static func GLtanh<T:FloatingPointArithmeticType>(x:T) -> T {
199+
public static func SGLtanh<T:FloatingPointArithmeticType>(x:T) -> T {
200200
if let z = x as? Double {
201201
return tanh(z) as! T
202202
}
@@ -206,7 +206,7 @@ public final class SGLMath {
206206
preconditionFailure()
207207
}
208208

209-
public static func GLasinh<T:FloatingPointArithmeticType>(x:T) -> T {
209+
public static func SGLasinh<T:FloatingPointArithmeticType>(x:T) -> T {
210210
if let z = x as? Double {
211211
return asinh(z) as! T
212212
}
@@ -216,7 +216,7 @@ public final class SGLMath {
216216
preconditionFailure()
217217
}
218218

219-
public static func GLacosh<T:FloatingPointArithmeticType>(x:T) -> T {
219+
public static func SGLacosh<T:FloatingPointArithmeticType>(x:T) -> T {
220220
if let z = x as? Double {
221221
return acosh(z) as! T
222222
}
@@ -226,7 +226,7 @@ public final class SGLMath {
226226
preconditionFailure()
227227
}
228228

229-
public static func GLatanh<T:FloatingPointArithmeticType>(x:T) -> T {
229+
public static func SGLatanh<T:FloatingPointArithmeticType>(x:T) -> T {
230230
if let z = x as? Double {
231231
return atanh(z) as! T
232232
}
@@ -236,7 +236,7 @@ public final class SGLMath {
236236
preconditionFailure()
237237
}
238238

239-
public static func GLpow<T:FloatingPointArithmeticType>(x:T, _ y:T) -> T {
239+
public static func SGLpow<T:FloatingPointArithmeticType>(x:T, _ y:T) -> T {
240240
if let z = x as? Double {
241241
return pow(z, y as! Double) as! T
242242
}
@@ -245,7 +245,7 @@ public final class SGLMath {
245245
}
246246
preconditionFailure()
247247
}
248-
public static func GLexp<T:FloatingPointArithmeticType>(x:T) -> T {
248+
public static func SGLexp<T:FloatingPointArithmeticType>(x:T) -> T {
249249
if let z = x as? Double {
250250
return exp(z) as! T
251251
}
@@ -254,7 +254,7 @@ public final class SGLMath {
254254
}
255255
preconditionFailure()
256256
}
257-
public static func GLlog<T:FloatingPointArithmeticType>(x:T) -> T {
257+
public static func SGLlog<T:FloatingPointArithmeticType>(x:T) -> T {
258258
if let z = x as? Double {
259259
return log(z) as! T
260260
}
@@ -264,7 +264,7 @@ public final class SGLMath {
264264
preconditionFailure()
265265
}
266266

267-
public static func GLexp2<T:FloatingPointArithmeticType>(x:T) -> T {
267+
public static func SGLexp2<T:FloatingPointArithmeticType>(x:T) -> T {
268268
if let z = x as? Double {
269269
return exp2(z) as! T
270270
}
@@ -273,7 +273,7 @@ public final class SGLMath {
273273
}
274274
preconditionFailure()
275275
}
276-
public static func GLlog2<T:FloatingPointArithmeticType>(x:T) -> T {
276+
public static func SGLlog2<T:FloatingPointArithmeticType>(x:T) -> T {
277277
if let z = x as? Double {
278278
return log2(z) as! T
279279
}
@@ -283,7 +283,7 @@ public final class SGLMath {
283283
preconditionFailure()
284284
}
285285

286-
public static func GLsqrt<T:FloatingPointArithmeticType>(x:T) -> T {
286+
public static func SGLsqrt<T:FloatingPointArithmeticType>(x:T) -> T {
287287
if let z = x as? Double {
288288
return sqrt(z) as! T
289289
}
@@ -293,7 +293,7 @@ public final class SGLMath {
293293
preconditionFailure()
294294
}
295295

296-
public static func GLfloor<T:FloatingPointArithmeticType>(x:T) -> T {
296+
public static func SGLfloor<T:FloatingPointArithmeticType>(x:T) -> T {
297297
if let z = x as? Double {
298298
return floor(z) as! T
299299
}
@@ -303,7 +303,7 @@ public final class SGLMath {
303303
preconditionFailure()
304304
}
305305

306-
public static func GLtrunc<T:FloatingPointArithmeticType>(x:T) -> T {
306+
public static func SGLtrunc<T:FloatingPointArithmeticType>(x:T) -> T {
307307
if let z = x as? Double {
308308
return trunc(z) as! T
309309
}
@@ -313,7 +313,7 @@ public final class SGLMath {
313313
preconditionFailure()
314314
}
315315

316-
public static func GLround<T:FloatingPointArithmeticType>(x:T) -> T {
316+
public static func SGLround<T:FloatingPointArithmeticType>(x:T) -> T {
317317
if let z = x as? Double {
318318
return round(z) as! T
319319
}
@@ -323,7 +323,7 @@ public final class SGLMath {
323323
preconditionFailure()
324324
}
325325

326-
public static func GLceil<T:FloatingPointArithmeticType>(x:T) -> T {
326+
public static func SGLceil<T:FloatingPointArithmeticType>(x:T) -> T {
327327
if let z = x as? Double {
328328
return ceil(z) as! T
329329
}
@@ -333,7 +333,7 @@ public final class SGLMath {
333333
preconditionFailure()
334334
}
335335

336-
public static func GLmodf<T:FloatingPointArithmeticType>(x:T, inout _ i:T) -> T {
336+
public static func SGLmodf<T:FloatingPointArithmeticType>(x:T, inout _ i:T) -> T {
337337
if let z = x as? Double {
338338
return withUnsafeMutablePointer(&i) {
339339
return modf(z, UnsafeMutablePointer<Double>($0)) as! T
@@ -347,7 +347,7 @@ public final class SGLMath {
347347
preconditionFailure()
348348
}
349349

350-
public static func GLfma<T:FloatingPointArithmeticType>(a:T, _ b:T, _ c:T) -> T {
350+
public static func SGLfma<T:FloatingPointArithmeticType>(a:T, _ b:T, _ c:T) -> T {
351351
if let z = a as? Double {
352352
return fma(z, b as! Double, c as! Double) as! T
353353
}
@@ -357,7 +357,7 @@ public final class SGLMath {
357357
preconditionFailure()
358358
}
359359

360-
public static func GLfrexp<T:FloatingPointArithmeticType>(x:T, inout _ exp:Int32) -> T {
360+
public static func SGLfrexp<T:FloatingPointArithmeticType>(x:T, inout _ exp:Int32) -> T {
361361
if let z = x as? Double {
362362
return frexp(z, &exp) as! T
363363
}
@@ -367,7 +367,7 @@ public final class SGLMath {
367367
preconditionFailure()
368368
}
369369

370-
public static func GLldexp<T:FloatingPointArithmeticType>(x:T, _ exp:Int32) -> T {
370+
public static func SGLldexp<T:FloatingPointArithmeticType>(x:T, _ exp:Int32) -> T {
371371
if let z = x as? Double {
372372
return ldexp(z, exp) as! T
373373
}

0 commit comments

Comments
 (0)