1 |
cvsrabit |
1.1 |
VERSION 1.0 CLASS |
2 |
|
|
BEGIN |
3 |
|
|
MultiUse = -1 'True |
4 |
|
|
Persistable = 0 'NotPersistable |
5 |
|
|
DataBindingBehavior = 0 'vbNone |
6 |
|
|
DataSourceBehavior = 0 'vbNone |
7 |
|
|
MTSTransactionMode = 0 'NotAnMTSObject |
8 |
|
|
END |
9 |
|
|
Attribute VB_Name = "Class_TrackSegment" |
10 |
|
|
Attribute VB_GlobalNameSpace = False |
11 |
|
|
Attribute VB_Creatable = True |
12 |
|
|
Attribute VB_PredeclaredId = False |
13 |
|
|
Attribute VB_Exposed = False |
14 |
|
|
Option Explicit |
15 |
|
|
|
16 |
|
|
' --- public ---------------------------------------------------------------------------------------------- |
17 |
|
|
|
18 |
|
|
' --- private -------------------------------------------------------------------------------------------- |
19 |
|
|
|
20 |
|
|
Private prvtpVecPoint1 As D3DVECTOR |
21 |
|
|
Private prvtpVecPoint2 As D3DVECTOR |
22 |
|
|
' |
23 |
|
|
|
24 |
|
|
Public Sub SetPoints(tpVecPoint1 As D3DVECTOR, tpVecPoint2 As D3DVECTOR) |
25 |
|
|
|
26 |
|
|
prvtpVecPoint1 = tpVecPoint1 |
27 |
|
|
prvtpVecPoint2 = tpVecPoint2 |
28 |
|
|
|
29 |
|
|
End Sub |
30 |
|
|
|
31 |
|
|
Public Function GetSide(tpVecPoint As D3DVECTOR) As Boolean |
32 |
|
|
|
33 |
|
|
Dim sgVsX As Single |
34 |
|
|
Dim sgVsZ As Single |
35 |
|
|
|
36 |
|
|
Dim sgVnX As Single |
37 |
|
|
Dim sgVnZ As Single |
38 |
|
|
|
39 |
|
|
Dim sgVpX As Single |
40 |
|
|
Dim sgVpZ As Single |
41 |
|
|
|
42 |
|
|
Dim sgScalar As Single |
43 |
|
|
|
44 |
|
|
sgVsX = prvtpVecPoint2.X - prvtpVecPoint1.X ' Vs |
45 |
|
|
sgVsZ = prvtpVecPoint2.Z - prvtpVecPoint1.Z |
46 |
|
|
|
47 |
|
|
sgVnX = sgVsZ ' normal of Vs |
48 |
|
|
sgVnZ = -sgVsX |
49 |
|
|
|
50 |
|
|
sgVpX = tpVecPoint.X - prvtpVecPoint1.X ' Vs |
51 |
|
|
sgVpZ = tpVecPoint.Z - prvtpVecPoint1.Z ' Vs |
52 |
|
|
|
53 |
|
|
sgScalar = sgVpX * sgVnX + sgVpZ * sgVnZ |
54 |
|
|
|
55 |
|
|
GetSide = sgScalar < 0 |
56 |
|
|
|
57 |
|
|
End Function |