@@ -236,41 +236,6 @@ Module MathModule
236
236
' matrix[2][3] = 0.f;
237
237
'}
238
238
''Public Sub AngleMatrix(ByVal pitchDegrees As Double, ByVal yawDegrees As Double, ByVal rollDegrees As Double, ByRef matrixColumn0 As SourceVector, ByRef matrixColumn1 As SourceVector, ByRef matrixColumn2 As SourceVector)
239
- Public Sub AngleMatrix( ByVal pitchRadians As Single , ByVal yawRadians As Single , ByVal rollRadians As Single , ByRef matrixColumn0 As SourceVectorSingle, ByRef matrixColumn1 As SourceVectorSingle, ByRef matrixColumn2 As SourceVectorSingle, ByRef matrixColumn3 As SourceVectorSingle)
240
- 'Dim pitchRadians As Double
241
- 'Dim yawRadians As Double
242
- 'Dim rollRadians As Double
243
- Dim sr As Single
244
- Dim sp As Single
245
- Dim sy As Single
246
- Dim cr As Single
247
- Dim cp As Single
248
- Dim cy As Single
249
-
250
- 'pitchRadians = DegreesToRadians(pitchDegrees)
251
- 'yawRadians = DegreesToRadians(yawDegrees)
252
- 'rollRadians = DegreesToRadians(rollDegrees)
253
-
254
- sy = CSng (Math.Sin(yawRadians))
255
- cy = CSng (Math.Cos(yawRadians))
256
- sp = CSng (Math.Sin(pitchRadians))
257
- cp = CSng (Math.Cos(pitchRadians))
258
- sr = CSng (Math.Sin(rollRadians))
259
- cr = CSng (Math.Cos(rollRadians))
260
-
261
- matrixColumn0.x = cp * cy
262
- matrixColumn0.y = cp * sy
263
- matrixColumn0.z = -sp
264
- matrixColumn1.x = sr * sp * cy + cr * -sy
265
- matrixColumn1.y = sr * sp * sy + cr * cy
266
- matrixColumn1.z = sr * cp
267
- matrixColumn2.x = (cr * sp * cy + -sr * -sy)
268
- matrixColumn2.y = (cr * sp * sy + -sr * cy)
269
- matrixColumn2.z = cr * cp
270
- matrixColumn3.x = 0
271
- matrixColumn3.y = 0
272
- matrixColumn3.z = 0
273
- End Sub
274
239
Public Sub AngleMatrix( ByVal pitchRadians As Double , ByVal yawRadians As Double , ByVal rollRadians As Double , ByRef matrixColumn0 As SourceVector, ByRef matrixColumn1 As SourceVector, ByRef matrixColumn2 As SourceVector, ByRef matrixColumn3 As SourceVector)
275
240
'Dim pitchRadians As Double
276
241
'Dim yawRadians As Double
@@ -439,22 +404,6 @@ Module MathModule
439
404
' out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +
440
405
' in1[2][2] * in2[2][3] + in1[2][3];
441
406
'}
442
- Public Sub R_ConcatTransforms( ByVal in1_matrixColumn0 As SourceVectorSingle, ByVal in1_matrixColumn1 As SourceVectorSingle, ByVal in1_matrixColumn2 As SourceVectorSingle, ByVal in1_matrixColumn3 As SourceVectorSingle, ByVal in2_matrixColumn0 As SourceVectorSingle, ByVal in2_matrixColumn1 As SourceVectorSingle, ByVal in2_matrixColumn2 As SourceVectorSingle, ByVal in2_matrixColumn3 As SourceVectorSingle, ByRef out_matrixColumn0 As SourceVectorSingle, ByRef out_matrixColumn1 As SourceVectorSingle, ByRef out_matrixColumn2 As SourceVectorSingle, ByRef out_matrixColumn3 As SourceVectorSingle)
443
- out_matrixColumn0.x = in1_matrixColumn0.x * in2_matrixColumn0.x + in1_matrixColumn1.x * in2_matrixColumn0.y + in1_matrixColumn2.x * in2_matrixColumn0.z
444
- out_matrixColumn1.x = in1_matrixColumn0.x * in2_matrixColumn1.x + in1_matrixColumn1.x * in2_matrixColumn1.y + in1_matrixColumn2.x * in2_matrixColumn1.z
445
- out_matrixColumn2.x = in1_matrixColumn0.x * in2_matrixColumn2.x + in1_matrixColumn1.x * in2_matrixColumn2.y + in1_matrixColumn2.x * in2_matrixColumn2.z
446
- out_matrixColumn3.x = in1_matrixColumn0.x * in2_matrixColumn3.x + in1_matrixColumn1.x * in2_matrixColumn3.y + in1_matrixColumn2.x * in2_matrixColumn3.z + in1_matrixColumn3.x
447
-
448
- out_matrixColumn0.y = in1_matrixColumn0.y * in2_matrixColumn0.x + in1_matrixColumn1.y * in2_matrixColumn0.y + in1_matrixColumn2.y * in2_matrixColumn0.z
449
- out_matrixColumn1.y = in1_matrixColumn0.y * in2_matrixColumn1.x + in1_matrixColumn1.y * in2_matrixColumn1.y + in1_matrixColumn2.y * in2_matrixColumn1.z
450
- out_matrixColumn2.y = in1_matrixColumn0.y * in2_matrixColumn2.x + in1_matrixColumn1.y * in2_matrixColumn2.y + in1_matrixColumn2.y * in2_matrixColumn2.z
451
- out_matrixColumn3.y = in1_matrixColumn0.y * in2_matrixColumn3.x + in1_matrixColumn1.y * in2_matrixColumn3.y + in1_matrixColumn2.y * in2_matrixColumn3.z + in1_matrixColumn3.y
452
-
453
- out_matrixColumn0.z = in1_matrixColumn0.z * in2_matrixColumn0.x + in1_matrixColumn1.z * in2_matrixColumn0.y + in1_matrixColumn2.z * in2_matrixColumn0.z
454
- out_matrixColumn1.z = in1_matrixColumn0.z * in2_matrixColumn1.x + in1_matrixColumn1.z * in2_matrixColumn1.y + in1_matrixColumn2.z * in2_matrixColumn1.z
455
- out_matrixColumn2.z = in1_matrixColumn0.z * in2_matrixColumn2.x + in1_matrixColumn1.z * in2_matrixColumn2.y + in1_matrixColumn2.z * in2_matrixColumn2.z
456
- out_matrixColumn3.z = in1_matrixColumn0.z * in2_matrixColumn3.x + in1_matrixColumn1.z * in2_matrixColumn3.y + in1_matrixColumn2.z * in2_matrixColumn3.z + in1_matrixColumn3.z
457
- End Sub
458
407
Public Sub R_ConcatTransforms( ByVal in1_matrixColumn0 As SourceVector, ByVal in1_matrixColumn1 As SourceVector, ByVal in1_matrixColumn2 As SourceVector, ByVal in1_matrixColumn3 As SourceVector, ByVal in2_matrixColumn0 As SourceVector, ByVal in2_matrixColumn1 As SourceVector, ByVal in2_matrixColumn2 As SourceVector, ByVal in2_matrixColumn3 As SourceVector, ByRef out_matrixColumn0 As SourceVector, ByRef out_matrixColumn1 As SourceVector, ByRef out_matrixColumn2 As SourceVector, ByRef out_matrixColumn3 As SourceVector)
459
408
out_matrixColumn0.x = in1_matrixColumn0.x * in2_matrixColumn0.x + in1_matrixColumn1.x * in2_matrixColumn0.y + in1_matrixColumn2.x * in2_matrixColumn0.z
460
409
out_matrixColumn1.x = in1_matrixColumn0.x * in2_matrixColumn1.x + in1_matrixColumn1.x * in2_matrixColumn1.y + in1_matrixColumn2.x * in2_matrixColumn1.z
@@ -537,18 +486,10 @@ Module MathModule
537
486
'{
538
487
' return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
539
488
'}
540
- Public Function DotProduct( ByVal vector1 As SourceVectorSingle, ByVal vector2 As SourceVectorSingle) As Single
541
- Return vector1.x * vector2.x + vector1.y * vector2.y + vector1.z * vector2.z
542
- End Function
543
489
Public Function DotProduct( ByVal vector1 As SourceVector, ByVal vector2 As SourceVector) As Double
544
490
Return vector1.x * vector2.x + vector1.y * vector2.y + vector1.z * vector2.z
545
491
End Function
546
492
547
- Public Sub VectorCopy( ByVal input As SourceVectorSingle, ByRef output As SourceVectorSingle)
548
- output.x = input.x
549
- output.y = input.y
550
- output.z = input.z
551
- End Sub
552
493
553
494
Public Sub VectorCopy( ByVal input As SourceVector, ByRef output As SourceVector)
554
495
output.x = input.x
@@ -563,35 +504,6 @@ Module MathModule
563
504
' out[1] = DotProduct(in1, in2[1]);
564
505
' out[2] = DotProduct(in1, in2[2]);
565
506
'}
566
- Public Function VectorRotate( ByVal input As SourceVectorSingle, ByVal matrixColumn0 As SourceVectorSingle, ByVal matrixColumn1 As SourceVectorSingle, ByVal matrixColumn2 As SourceVectorSingle, ByVal matrixColumn3 As SourceVectorSingle) As SourceVectorSingle
567
- Dim output As SourceVectorSingle
568
- Dim matrixRow0 As SourceVectorSingle
569
- Dim matrixRow1 As SourceVectorSingle
570
- Dim matrixRow2 As SourceVectorSingle
571
-
572
- output = New SourceVectorSingle()
573
- matrixRow0 = New SourceVectorSingle()
574
- matrixRow1 = New SourceVectorSingle()
575
- matrixRow2 = New SourceVectorSingle()
576
-
577
- matrixRow0.x = matrixColumn0.x
578
- matrixRow0.y = matrixColumn1.x
579
- matrixRow0.z = matrixColumn2.x
580
-
581
- matrixRow1.x = matrixColumn0.y
582
- matrixRow1.y = matrixColumn1.y
583
- matrixRow1.z = matrixColumn2.y
584
-
585
- matrixRow2.x = matrixColumn0.z
586
- matrixRow2.y = matrixColumn1.z
587
- matrixRow2.z = matrixColumn2.z
588
-
589
- output.x = DotProduct(input, matrixRow0)
590
- output.y = DotProduct(input, matrixRow1)
591
- output.z = DotProduct(input, matrixRow2)
592
-
593
- Return output
594
- End Function
595
507
Public Function VectorRotate( ByVal input As SourceVector, ByVal matrixColumn0 As SourceVector, ByVal matrixColumn1 As SourceVector, ByVal matrixColumn2 As SourceVector, ByVal matrixColumn3 As SourceVector) As SourceVector
596
508
Dim output As SourceVector
597
509
Dim matrixRow0 As SourceVector
@@ -662,24 +574,6 @@ Module MathModule
662
574
'
663
575
' return length;
664
576
'}
665
- Public Function VectorNormalize( ByRef ioVector As SourceVectorSingle) As Single
666
- Dim length As Single
667
-
668
- length = 0
669
- length += ioVector.x * ioVector.x
670
- length += ioVector.y * ioVector.y
671
- length += ioVector.z * ioVector.z
672
- length = CSng (Math.Sqrt(length))
673
- If length = 0 Then
674
- Return 0
675
- End If
676
-
677
- ioVector.x /= length
678
- ioVector.y /= length
679
- ioVector.z /= length
680
-
681
- Return length
682
- End Function
683
577
Public Function VectorNormalize( ByRef ioVector As SourceVector) As Double
684
578
Dim length As Double
685
579
@@ -710,35 +604,6 @@ Module MathModule
710
604
' out[1] = DotProduct(in1, in2[1]) + in2[1][3];
711
605
' out[2] = DotProduct(in1, in2[2]) + in2[2][3];
712
606
'}
713
- Public Function VectorTransform( ByVal input As SourceVectorSingle, ByVal matrixColumn0 As SourceVectorSingle, ByVal matrixColumn1 As SourceVectorSingle, ByVal matrixColumn2 As SourceVectorSingle, ByVal matrixColumn3 As SourceVectorSingle) As SourceVectorSingle
714
- Dim output As SourceVectorSingle
715
- Dim matrixRow0 As SourceVectorSingle
716
- Dim matrixRow1 As SourceVectorSingle
717
- Dim matrixRow2 As SourceVectorSingle
718
-
719
- output = New SourceVectorSingle()
720
- matrixRow0 = New SourceVectorSingle()
721
- matrixRow1 = New SourceVectorSingle()
722
- matrixRow2 = New SourceVectorSingle()
723
-
724
- matrixRow0.x = matrixColumn0.x
725
- matrixRow0.y = matrixColumn1.x
726
- matrixRow0.z = matrixColumn2.x
727
-
728
- matrixRow1.x = matrixColumn0.y
729
- matrixRow1.y = matrixColumn1.y
730
- matrixRow1.z = matrixColumn2.y
731
-
732
- matrixRow2.x = matrixColumn0.z
733
- matrixRow2.y = matrixColumn1.z
734
- matrixRow2.z = matrixColumn2.z
735
-
736
- output.x = DotProduct(input, matrixRow0) + matrixColumn3.x
737
- output.y = DotProduct(input, matrixRow1) + matrixColumn3.y
738
- output.z = DotProduct(input, matrixRow2) + matrixColumn3.z
739
-
740
- Return output
741
- End Function
742
607
Public Function VectorTransform( ByVal input As SourceVector, ByVal matrixColumn0 As SourceVector, ByVal matrixColumn1 As SourceVector, ByVal matrixColumn2 As SourceVector, ByVal matrixColumn3 As SourceVector) As SourceVector
743
608
Dim output As SourceVector
744
609
Dim matrixRow0 As SourceVector
0 commit comments