aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a02448.html
blob: dc96c7a0a02ea79d5383084af57f2aa54756415a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NLPACS::CEdgeCollide class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex">  <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NLPACS::CEdgeCollide Class Reference</h1><code>#include &lt;<a class="el" href="a05665.html">edge_collide.h</a>&gt;</code>
<p>
<p>Inheritance diagram for NLPACS::CEdgeCollide:
<p><center><img src="a02448.png" usemap="#NLPACS::CEdgeCollide_map" border="0" alt=""></center>
<map name="NLPACS::CEdgeCollide_map">
<area href="a02449.html" alt="NLPACS::CEdgeCollideNode" shape="rect" coords="0,56,175,80">
</map>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Collisions against edge in 2D. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a05665.html#l00180">180</a> of file <a class="el" href="a05665.html">edge_collide.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>enum &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5">TPointMoveProblem</a> { <br>
&nbsp;&nbsp;<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1">ParallelEdges</a> = 0, 
<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3">StartOnEdge</a>, 
<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4">StopOnEdge</a>, 
<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6">TraverseEndPoint</a>, 
<br>
&nbsp;&nbsp;<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0">EdgeNull</a>, 
<a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew2">PointMoveProblemCount</a>
<br>
 }</td></tr>

<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea1">make</a> (const <a class="el" href="a03660.html">CVector2f</a> &amp;p0, const <a class="el" href="a03660.html">CVector2f</a> &amp;p1)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea2">testBBoxCollide</a> (const <a class="el" href="a03660.html">CVector2f</a> bbox[4])</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>float&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea3">testBBoxMove</a> (const <a class="el" href="a03660.html">CVector2f</a> &amp;start, const <a class="el" href="a03660.html">CVector2f</a> &amp;delta, const <a class="el" href="a03660.html">CVector2f</a> bbox[4], <a class="el" href="a03660.html">CVector2f</a> &amp;normal)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>float&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea4">testCircleMove</a> (const <a class="el" href="a03660.html">CVector2f</a> &amp;start, const <a class="el" href="a03660.html">CVector2f</a> &amp;delta, float radius, <a class="el" href="a03660.html">CVector2f</a> &amp;normal)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03305.html">CRational64</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodea5">testPointMove</a> (const <a class="el" href="a03660.html">CVector2f</a> &amp;start, const <a class="el" href="a03660.html">CVector2f</a> &amp;end, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5">TPointMoveProblem</a> &amp;moveBug)</td></tr>

<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>float&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">A0</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>float&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">A1</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>float&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">C</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03660.html">CVector2f</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03660.html">CVector2f</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03660.html">CVector2f</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03660.html">CVector2f</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a></td></tr>

<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollided0">testEdgeMove</a> (const <a class="el" href="a03660.html">CVector2f</a> &amp;q0, const <a class="el" href="a03660.html">CVector2f</a> &amp;q1, const <a class="el" href="a03660.html">CVector2f</a> &amp;delta, float &amp;tMin, float &amp;tMax, bool &amp;normalOnBox)</td></tr>

</table>
<hr><h2>Member Enumeration Documentation</h2>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5" doxytag="NLPACS::CEdgeCollide::TPointMoveProblem" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> enum <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5">NLPACS::CEdgeCollide::TPointMoveProblem</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<dl compact><dt><b>Enumeration values: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1" doxytag="ParallelEdges" ></a>ParallelEdges</em>&nbsp;</td><td>
</td></tr>
<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3" doxytag="StartOnEdge" ></a>StartOnEdge</em>&nbsp;</td><td>
</td></tr>
<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4" doxytag="StopOnEdge" ></a>StopOnEdge</em>&nbsp;</td><td>
</td></tr>
<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6" doxytag="TraverseEndPoint" ></a>TraverseEndPoint</em>&nbsp;</td><td>
</td></tr>
<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0" doxytag="EdgeNull" ></a>EdgeNull</em>&nbsp;</td><td>
</td></tr>
<tr><td valign=top><em><a class="anchor" name="NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew2" doxytag="PointMoveProblemCount" ></a>PointMoveProblemCount</em>&nbsp;</td><td>
</td></tr>
</table>
</dl>

<p>
Definition at line <a class="el" href="a05665.html#l00183">183</a> of file <a class="el" href="a05665.html">edge_collide.h</a>.
<p>
<div class="fragment"><pre>00183 {<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1">ParallelEdges</a>=0, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3">StartOnEdge</a>, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4">StopOnEdge</a>, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6">TraverseEndPoint</a>, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0">EdgeNull</a>, <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew2">PointMoveProblemCount</a>};
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea1" doxytag="NLPACS::CEdgeCollide::make" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NLPACS::CEdgeCollide::make </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>p0</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>p1</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05664.html#l00043">43</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>.
<p>
References <a class="el" href="a05665.html#l00190">A0</a>, <a class="el" href="a05665.html#l00190">A1</a>, <a class="el" href="a05665.html#l00191">C</a>, <a class="el" href="a05665.html#l00189">Norm</a>, <a class="el" href="a06677.html#l00093">NLMISC::CVector2f::normalize()</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
<p>
Referenced by <a class="el" href="a05929.html#l01807">NLPACS::CLocalRetriever::testCollision()</a>, and <a class="el" href="a06337.html#l00635">NLPACS::CRetrieverInstance::testExteriorCollision()</a>.
<p>
<div class="fragment"><pre>00044 {
00045         <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>= p0;
00046         <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>= p1;
00047         <span class="comment">// translation axis of the edge.</span>
00048         <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>;
00049         <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>.normalize();
00050         <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">A0</a>= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>;
00051         <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">A1</a>= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>*Dir;
00052         <span class="comment">// line equation.</span>
00053         <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>.x=  Dir.y;
00054         <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>.y= -Dir.x;
00055         <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">C</a>= - <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>;
00056 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea2" doxytag="NLPACS::CEdgeCollide::testBBoxCollide" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool NLPACS::CEdgeCollide::testBBoxCollide </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>bbox</em>[4]          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
return true if this oriented bbox collide this edge. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>bbox</em>&nbsp;</td><td>4 points of the bbox, in CCW. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>true if collision occurs.</dd></dl>

<p>
Definition at line <a class="el" href="a05664.html#l00657">657</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>.
<p>
References <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
<p>
Referenced by <a class="el" href="a05761.html#l02303">NLPACS::CGlobalRetriever::testRotCollisionWithCollisionChains()</a>.
<p>
<div class="fragment"><pre>00658 {
00659         <span class="comment">// clip the edge against the edge of the bbox.</span>
00660         CVector2f               p0= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>, p1= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>;
00661 
00662         <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0; i&lt;4; i++)
00663         {
00664                 CVector2f       a= bbox[i];
00665                 CVector2f       b= bbox[(i+1)&amp;3];
00666                 CVector2f       delta= b-a, norm;
00667                 <span class="comment">// sign is important. bbox is CCW. normal goes OUT the bbox.</span>
00668                 norm.x= delta.y;
00669                 norm.y= -delta.x;
00670 
00671                 <span class="keywordtype">float</span>   d0= (p0-a)*norm;
00672                 <span class="keywordtype">float</span>   d1= (p1-a)*norm;
00673 
00674                 <span class="comment">// if boths points are out this plane, no collision.</span>
00675                 <span class="keywordflow">if</span>( d0&gt;0 &amp;&amp; d1&gt;0)
00676                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
00677                 <span class="comment">// if difference, must clip.</span>
00678                 <span class="keywordflow">if</span>( d0&gt;0 || d1&gt;0)
00679                 {
00680                         CVector2f       intersect= p0 + (p1-p0)* ((0-d0)/(d1-d0));
00681                         <span class="keywordflow">if</span>(d1&gt;0)
00682                                 p1= intersect;
00683                         <span class="keywordflow">else</span>
00684                                 p0= intersect;
00685                 }
00686         }
00687 
00688         <span class="comment">// if a segment is still in the bbox, collision occurs.</span>
00689         <span class="keywordflow">return</span> <span class="keyword">true</span>;
00690 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea3" doxytag="NLPACS::CEdgeCollide::testBBoxMove" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> float NLPACS::CEdgeCollide::testBBoxMove </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>start</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>delta</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a>&nbsp;</td>
          <td class="mdname" nowrap> <em>bbox</em>[4], </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>normal</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
return 1 either if the bbox moves away from the line, or no collision occurs. Else return a [0,1[ interval. If collision occurs (ie return&lt;1), return in "normal" the normal of the collision. It may be normal of edge (+-), or normal against a point of the edge. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>bbox</em>&nbsp;</td><td>4 points of the bbox at start. start must be the barycentre of those points.</td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a05664.html#l00559">559</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>.
<p>
References <a class="el" href="a05665.html#l00191">C</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05665.html#l00189">Norm</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05664.html#l00394">testEdgeMove()</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
<p>
Referenced by <a class="el" href="a05761.html#l01392">NLPACS::CGlobalRetriever::testCollisionWithCollisionChains()</a>.
<p>
<div class="fragment"><pre>00560 {
00561         <span class="comment">// distance from center to line.</span>
00562         <span class="keywordtype">float</span>   dist= start*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a> + <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">C</a>;
00563 
00564         <span class="comment">// test if the movement is against the line or not.</span>
00565         <span class="keywordtype">bool</span>    sensPos= dist&gt;0;
00566         <span class="comment">// if signs are equals, same side of the line, so we allow the circle to leave the line.</span>
00567         <span class="comment">/*if(sensPos==sensSpeed)</span>
00568 <span class="comment">                return 1;*/</span>
00569 
00570 
00571         <span class="comment">// Else, do 4 test edge/edge, and return Tmin.</span>
00572         <span class="keywordtype">float</span>   tMin, tMax;
00573         <span class="keywordtype">bool</span>    edgeCollided= <span class="keyword">false</span>;
00574         <span class="keywordtype">bool</span>    normalOnBox= <span class="keyword">false</span>;
00575         CVector2f       boxNormal;
00576         <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i&lt;4;i++)
00577         {
00578                 <span class="keywordtype">float</span>   t0, t1;
00579                 <span class="keywordtype">bool</span>    nob;
00580                 CVector2f       a= bbox[i];
00581                 CVector2f       b= bbox[(i+1)&amp;3];
00582 
00583                 <span class="comment">// test move against this edge.</span>
00584                 <span class="keywordflow">if</span>(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollided0">testEdgeMove</a>(a, b, delta, t0, t1, nob))
00585                 {
00586                         <span class="keywordflow">if</span>(edgeCollided)
00587                         {
00588                                 tMin= <a class="code" href="a04061.html#a0">min</a>(t0, tMin);
00589                                 tMax= max(t1, tMax);
00590                         }
00591                         <span class="keywordflow">else</span>
00592                         {
00593                                 edgeCollided= <span class="keyword">true</span>;
00594                                 tMin= t0;
00595                                 tMax= t1;
00596                         }
00597 
00598                         <span class="comment">// get normal of box against we collide.</span>
00599                         <span class="keywordflow">if</span>(tMin==t0)
00600                         {
00601                                 normalOnBox= nob;
00602                                 <span class="keywordflow">if</span>(nob)
00603                                 {
00604                                         CVector2f       dab;
00605                                         <span class="comment">// bbox must be CCW.</span>
00606                                         dab= b-a;
00607                                         <span class="comment">// the normal is computed so that the vector goes In the bbox.</span>
00608                                         boxNormal.x= -dab.y;
00609                                         boxNormal.y= dab.x;
00610                                 }
00611                         }
00612                 }
00613         }
00614 
00615         <span class="comment">// if collision occurs,and int the [0,1] interval...</span>
00616         <span class="keywordflow">if</span>(edgeCollided &amp;&amp; tMin&lt;1 &amp;&amp; tMax&gt;0)
00617         {
00618                 <span class="comment">// compute normal of collision.</span>
00619                 <span class="keywordflow">if</span>(normalOnBox)
00620                 {
00621                         <span class="comment">// assume collsion is an endpoint of the edge against the bbox.</span>
00622                         normal= boxNormal;
00623                 }
00624                 <span class="keywordflow">else</span>
00625                 {
00626                         <span class="comment">// assume collision occurs on interior of the edge. the normal to return is +- Norm.</span>
00627                         <span class="keywordflow">if</span>(sensPos)     <span class="comment">// if algebric distance of start position was &gt;0.</span>
00628                                 normal= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>;
00629                         <span class="keywordflow">else</span>
00630                                 normal= -Norm;
00631                 }
00632 
00633                 <span class="comment">// compute time of collison.</span>
00634                 <span class="keywordflow">if</span>(tMin&gt;0)
00635                         <span class="comment">// return time of collision.</span>
00636                         <span class="keywordflow">return</span> tMin;
00637                 <span class="keywordflow">else</span>
00638                 {
00639                         <span class="comment">// The bbox is inside the edge, at t==0. test if it goes out or not.</span>
00640                         <span class="comment">// accept only if we are much near the exit than the enter.</span>
00641                         <span class="comment">/* NB: 0.2 is an empirical value "which works well". Normally, 1 is the good value, but because of the</span>
00642 <span class="comment">                                "SURFACEMOVE NOT DETECTED" Problem (see testCircleMove()), we must be more restrictive.</span>
00643 <span class="comment">                        */</span>
00644                         <span class="keywordflow">if</span>( tMax&lt;0.2*(-tMin) )
00645                                 <span class="keywordflow">return</span> 1;
00646                         <span class="keywordflow">else</span>
00647                                 <span class="keywordflow">return</span> 0;
00648                 }
00649         }
00650         <span class="keywordflow">else</span>
00651                 <span class="keywordflow">return</span> 1;
00652 
00653 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea4" doxytag="NLPACS::CEdgeCollide::testCircleMove" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> float NLPACS::CEdgeCollide::testCircleMove </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>start</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>delta</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>float&nbsp;</td>
          <td class="mdname" nowrap> <em>radius</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>normal</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
return 1 either if the circle moves away from the line, or no collision occurs. Else return a [0,1[ interval. If collision occurs (ie return&lt;1), return in "normal" the normal of the collision. It may be normal of edge (+-), or normal against a point of the edge.
<p>
Definition at line <a class="el" href="a05664.html#l00265">265</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>.
<p>
References <a class="el" href="a05665.html#l00190">A0</a>, <a class="el" href="a05665.html#l00190">A1</a>, <a class="el" href="a05665.html#l00191">C</a>, <a class="el" href="a06677.html#l00113">NLMISC::CVector2f::isNull()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05665.html#l00189">Norm</a>, <a class="el" href="a06677.html#l00093">NLMISC::CVector2f::normalize()</a>, <a class="el" href="a05646.html#l00985">t</a>, and <a class="el" href="a05664.html#l00194">NLPACS::testCirclePoint()</a>.
<p>
Referenced by <a class="el" href="a05761.html#l01392">NLPACS::CGlobalRetriever::testCollisionWithCollisionChains()</a>.
<p>
<div class="fragment"><pre>00266 {
00267         <span class="comment">// If the movement is NULL, return 1 (no collision!)</span>
00268         <span class="keywordflow">if</span>(     delta.isNull() )
00269                 <span class="keywordflow">return</span> 1;
00270 
00271         <span class="comment">// distance from point to line.</span>
00272         <span class="keywordtype">double</span>  dist= start*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a> + <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">C</a>;
00273         <span class="comment">// projection of speed on normal.</span>
00274         <span class="keywordtype">double</span>  speed= delta*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">Norm</a>;
00275 
00276         <span class="comment">// test if the movement is against the line or not.</span>
00277         <span class="keywordtype">bool</span>    sensPos= dist&gt;0;
00278         <span class="keywordtype">bool</span>    sensSpeed= speed&gt;0;
00279 
00280         <span class="comment">// Does the point intersect the line?</span>
00281         dist= fabs(dist) - radius;
00282         speed= fabs(speed);
00283         <span class="keywordflow">if</span>( dist &gt; speed )
00284                 <span class="keywordflow">return</span> 1;
00285 
00286         <span class="comment">// if not already in collision with the line, test when it collides.</span>
00287         <span class="comment">// ===============================</span>
00288         <span class="keywordflow">if</span>(dist&gt;=0)
00289         {
00290                 <span class="comment">// if signs are equals, same side of the line, so we allow the circle to leave the line.</span>
00291                 <span class="keywordflow">if</span>(sensPos==sensSpeed )
00292                         <span class="keywordflow">return</span> 1;
00293 
00294                 <span class="comment">// if speed is 0, it means that movement is parralel to the line =&gt; never collide.</span>
00295                 <span class="keywordflow">if</span>(speed==0)
00296                         <span class="keywordflow">return</span> 1;
00297 
00298                 <span class="comment">// collide the line, at what time.</span>
00299                 <span class="keywordtype">double</span>  <a class="code" href="a04223.html#a627">t</a>= dist/speed;
00300 
00301 
00302                 <span class="comment">// compute the collision position of the Circle on the edge.</span>
00303                 <span class="comment">// this gives the center of the sphere at the collision point.</span>
00304                 <a class="code" href="a03659.html">CVector2d</a>       proj= <a class="code" href="a03659.html">CVector2d</a>(start) + CVector2d(delta)*<a class="code" href="a04223.html#a627">t</a>;
00305                 <span class="comment">// must add radius vector.</span>
00306                 proj+= Norm * (sensSpeed?radius:-radius);
00307                 <span class="comment">// compute projection on edge.</span>
00308                 <span class="keywordtype">double</span>          aProj= proj*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>;
00309 
00310                 <span class="comment">// if on the interval of the edge.</span>
00311                 <span class="keywordflow">if</span>( aProj&gt;=<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">A0</a> &amp;&amp; aProj&lt;=<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">A1</a>)
00312                 {
00313                         <span class="comment">// collision occurs on interior of the edge. the normal to return is +- Norm.</span>
00314                         <span class="keywordflow">if</span>(sensPos)     <span class="comment">// if algebric distance of start position was &gt;0.</span>
00315                                 normal= Norm;
00316                         <span class="keywordflow">else</span>
00317                                 normal= -Norm;
00318 
00319                         <span class="comment">// return time of collision.</span>
00320                         <span class="keywordflow">return</span> (<span class="keywordtype">float</span>)<a class="code" href="a04223.html#a627">t</a>;
00321                 }
00322         }
00323         <span class="comment">// else, must test if circle collide segment at t=0. if yes, return 0.</span>
00324         <span class="comment">// ===============================</span>
00325         <span class="keywordflow">else</span>
00326         {
00327                 <span class="comment">// There is just need to test if projection of circle's center onto the line hit the segment.</span>
00328                 <span class="comment">// This is not a good test to know if a circle intersect a segment, but other cases are</span>
00329                 <span class="comment">// managed with test of endPoints of the segment after.</span>
00330                 <span class="keywordtype">float</span>           aProj= start*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">Dir</a>;
00331 
00332                 <span class="comment">// if on the interval of the edge.</span>
00333                 <span class="keywordflow">if</span>( aProj&gt;=<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">A0</a> &amp;&amp; aProj&lt;=<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">A1</a>)
00334                 {
00335                         <span class="comment">// if signs are equals, same side of the line, so we allow the circle to leave the edge.</span>
00336                         <span class="comment">/* Special case: do not allow to leave the edge if we are too much in the edge.</span>
00337 <span class="comment">                         It is important for CGlobalRetriever::testCollisionWithCollisionChains() because of the</span>
00338 <span class="comment">                         "SURFACEMOVE NOT DETECTED" Problem.</span>
00339 <span class="comment">                         Suppose we can walk on this chain SA/SB (separate Surface A/SurfaceB). Suppose we are near this edge, </span>
00340 <span class="comment">                         and on Surface SA, and suppose there is an other chain SB/SC the circle collide with. If we </span>
00341 <span class="comment">                         return 1 (no collision), SB/SC won't be detected (because only SA/?? chains will be tested) and </span>
00342 <span class="comment">                         so the cylinder will penetrate SB/SC...</span>
00343 <span class="comment">                         This case arise at best if chains SA/SB and chain SB/SC do an angle of 45deg</span>
00344 <span class="comment"></span>
00345 <span class="comment">                         \todo yoyo: this is a Hack.</span>
00346 <span class="comment">                        */</span>
00347                         <span class="keywordflow">if</span>(sensPos==sensSpeed &amp;&amp; (-dist)&lt;0.5*radius)
00348                         {
00349                                 <span class="keywordflow">return</span> 1;
00350                         }
00351                         <span class="keywordflow">else</span>
00352                         {
00353                                 <span class="comment">// hit the interior of the edge, and sensPos!=sensSpeed. So must stop now!!</span>
00354                                 <span class="comment">// collision occurs on interior of the edge. the normal to return is +- Norm.</span>
00355                                 <span class="keywordflow">if</span>(sensPos)     <span class="comment">// if algebric distance of start position was &gt;0.</span>
00356                                         normal= Norm;
00357                                 <span class="keywordflow">else</span>
00358                                         normal= -Norm;
00359 
00360                                 <span class="keywordflow">return</span> 0;
00361                         }
00362                 }
00363         }
00364 
00365         <span class="comment">// In this case, the Circle do not hit the edge on the interior, but may hit on borders.</span>
00366         <span class="comment">// ===============================</span>
00367         <span class="comment">// Then, we must compute collision sphere-points.</span>
00368         <span class="keywordtype">float</span>           tmin, ttmp;
00369         <span class="comment">// first point.</span>
00370         tmin= <a class="code" href="a05380.html#a27">testCirclePoint</a>(start, delta, radius, P0);
00371         <span class="comment">// second point.</span>
00372         ttmp= <a class="code" href="a05380.html#a27">testCirclePoint</a>(start, delta, radius, P1);
00373         tmin= <a class="code" href="a04061.html#a0">min</a>(tmin, ttmp);
00374 
00375         <span class="comment">// if collision occurs, compute normal of collision.</span>
00376         <span class="keywordflow">if</span>(tmin&lt;1)
00377         {
00378                 <span class="comment">// to which point we collide?</span>
00379                 CVector2f       colPoint= tmin==ttmp? <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a> : <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>;
00380                 <span class="comment">// compute position of the entity at collision.</span>
00381                 CVector2f       colPos= start + delta*tmin;
00382 
00383                 <span class="comment">// and so we have this normal (the perpendicular of the tangent at this point).</span>
00384                 normal= colPos - colPoint;
00385                 normal.normalize();
00386         }
00387 
00388         <span class="keywordflow">return</span> tmin;
00389 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollided0" doxytag="NLPACS::CEdgeCollide::testEdgeMove" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool NLPACS::CEdgeCollide::testEdgeMove </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>q0</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>q1</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>delta</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>float &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>tMin</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>float &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>tMax</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>normalOnBox</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [private]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
test if edge collide against me. if true, return time intervals of collisions (]-oo, +oo[). NB: for simplicity, if lines are //, return false.
<p>
Definition at line <a class="el" href="a05664.html#l00394">394</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>.
<p>
References <a class="el" href="a05664.html#l00039">NLPACS::EdgeCollideEpsilon</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06677.html#l00089">NLMISC::CVector2f::norm()</a>, <a class="el" href="a06675.html#l00089">NLMISC::CVector2d::sqrnorm()</a>, <a class="el" href="a06675.html#l00053">NLMISC::CVector2d::x</a>, and <a class="el" href="a06675.html#l00053">NLMISC::CVector2d::y</a>.
<p>
Referenced by <a class="el" href="a05664.html#l00559">testBBoxMove()</a>.
<p>
<div class="fragment"><pre>00395 {
00396         <span class="keywordtype">double</span>  a,b,cv,cc,  d,e,f;
00397         <a class="code" href="a03659.html">CVector2d</a>       tmp;
00398 
00399         <span class="comment">// compute D1 line equation of q0q1. bx - ay + c(t)=0, where c is function of time [0,1].</span>
00400         <span class="comment">// ===========================</span>
00401         tmp= q1 - q0;           <span class="comment">// NB: along time, the direction doesn't change.</span>
00402         <span class="comment">// Divide by norm()�, so that  a projection on this edge is true if the proj is in interval [0,1].</span>
00403         tmp/= tmp.<a class="code" href="a03659.html#NLMISC_1_1CVector2dz2057_4">sqrnorm</a>();
00404         a= tmp.<a class="code" href="a03659.html#NLMISC_1_1CVector2do0">x</a>;
00405         b= tmp.<a class="code" href="a03659.html#NLMISC_1_1CVector2do1">y</a>;
00406         <span class="comment">// c= - q0(t)*CVector2d(b,-a).  but since q0(t) is a function of time t (q0+delta*t), compute cv, and cc.</span>
00407         <span class="comment">// so c= cv*t + cc.</span>
00408         cv= - <a class="code" href="a03659.html">CVector2d</a>(b,-a)*delta;
00409         cc= - <a class="code" href="a03659.html">CVector2d</a>(b,-a)*q0;
00410 
00411         <span class="comment">// compute D2 line equation of P0P1. ex - dy + f=0.</span>
00412         <span class="comment">// ===========================</span>
00413         tmp= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a> - <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>;
00414         <span class="comment">// Divide by norm()�, so that  a projection on this edge is true if the proj is in interval [0,1].</span>
00415         tmp/= tmp.<a class="code" href="a03659.html#NLMISC_1_1CVector2dz2057_4">sqrnorm</a>();
00416         d= tmp.<a class="code" href="a03659.html#NLMISC_1_1CVector2do0">x</a>;
00417         e= tmp.<a class="code" href="a03659.html#NLMISC_1_1CVector2do1">y</a>;
00418         f= - <a class="code" href="a03659.html">CVector2d</a>(e,-d)*<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>;
00419 
00420 
00421         <span class="comment">// Solve system.</span>
00422         <span class="comment">// ===========================</span>
00423         <span class="comment">/*</span>
00424 <span class="comment">                Compute the intersection I of 2 lines across time.</span>
00425 <span class="comment">                We have the system:</span>
00426 <span class="comment">                        bx - ay + c(t)=0</span>
00427 <span class="comment">                        ex - dy + f=0</span>
00428 <span class="comment"></span>
00429 <span class="comment">                which solve for:</span>
00430 <span class="comment">                        det= ae-bd      (0 &lt;=&gt; // lines)</span>
00431 <span class="comment">                        x(t)= (d*c(t) - fa) / det</span>
00432 <span class="comment">                        y(t)= (e*c(t) - fb) / det</span>
00433 <span class="comment">        */</span>
00434 
00435         <span class="comment">// determinant of matrix2x2.</span>
00436         <span class="keywordtype">double</span>  det= a*e - b*d;
00437         <span class="comment">// if to near of 0. (take delta for reference of test).</span>
00438         <span class="keywordflow">if</span>(det==0 || fabs(det)&lt;delta.norm()*<a class="code" href="a05380.html#a6">EdgeCollideEpsilon</a>)
00439                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00440 
00441         <span class="comment">// intersection I(t)= pInt + vInt*t.</span>
00442         <a class="code" href="a03659.html">CVector2d</a>               pInt, vInt;
00443         pInt.<a class="code" href="a03659.html#NLMISC_1_1CVector2do0">x</a>= ( d*cc - f*a ) / det;
00444         pInt.<a class="code" href="a03659.html#NLMISC_1_1CVector2do1">y</a>= ( e*cc - f*b ) / det;
00445         vInt.<a class="code" href="a03659.html#NLMISC_1_1CVector2do0">x</a>= ( d*cv ) / det;
00446         vInt.<a class="code" href="a03659.html#NLMISC_1_1CVector2do1">y</a>= ( e*cv ) / det;
00447 
00448 
00449         <span class="comment">// Project Intersection.</span>
00450         <span class="comment">// ===========================</span>
00451         <span class="comment">/*</span>
00452 <span class="comment">                Now, we project x,y onto each line D1 and D2, which gives  u(t) and v(t), each one giving the parameter of </span>
00453 <span class="comment">                the parametric line function. When it is in [0,1], we are on the edge.</span>
00454 <span class="comment"></span>
00455 <span class="comment">                u(t)= (I(t)-q0(t)) * CVector2d(a,b)     = uc + uv*t</span>
00456 <span class="comment">                v(t)= (I(t)-P0) * CVector2d(d,e)        = vc + vv*t</span>
00457 <span class="comment">        */</span>
00458         <span class="keywordtype">double</span>  uc, uv;
00459         <span class="keywordtype">double</span>  vc, vv;
00460         <span class="comment">// NB: q0(t)= q0+delta*t</span>
00461         uc= (pInt-q0) * <a class="code" href="a03659.html">CVector2d</a>(a,b);
00462         uv= (vInt-delta) * <a class="code" href="a03659.html">CVector2d</a>(a,b);
00463         vc= (pInt-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>) * <a class="code" href="a03659.html">CVector2d</a>(d,e);
00464         vv= (vInt) * <a class="code" href="a03659.html">CVector2d</a>(d,e);
00465 
00466 
00467         <span class="comment">// Compute intervals.</span>
00468         <span class="comment">// ===========================</span>
00469         <span class="comment">/*</span>
00470 <span class="comment">                Now, for each edge, compute time interval where parameter is in [0,1]. If intervals overlap, there is a collision.</span>
00471 <span class="comment">        */</span>
00472         <span class="keywordtype">double</span>  tu0, tu1, tv0, tv1;
00473         <span class="comment">// infinite interval.</span>
00474         <span class="keywordtype">bool</span>    allU=<span class="keyword">false</span>, allV=<span class="keyword">false</span>;
00475 
00476         <span class="comment">// compute time interval for u(t).</span>
00477         <span class="keywordflow">if</span>(uv==0 || fabs(uv)&lt;<a class="code" href="a05380.html#a6">EdgeCollideEpsilon</a>)
00478         {
00479                 <span class="comment">// The intersection does not move along D1. Always projected on u(t)=uc. so if in [0,1], OK, else never collide.</span>
00480                 <span class="keywordflow">if</span>(uc&lt;0 || uc&gt;1)
00481                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
00482                 <span class="comment">// else suppose "always valid".</span>
00483                 tu0 =tu1= 0;
00484                 allU= <span class="keyword">true</span>;
00485         }
00486         <span class="keywordflow">else</span>
00487         {
00488                 tu0= (0-uc)/uv; <span class="comment">// t for u(t)=0</span>
00489                 tu1= (1-uc)/uv; <span class="comment">// t for u(t)=1</span>
00490         }
00491 
00492         <span class="comment">// compute time interval for v(t).</span>
00493         <span class="keywordflow">if</span>(vv==0 || fabs(vv)&lt;<a class="code" href="a05380.html#a6">EdgeCollideEpsilon</a>)
00494         {
00495                 <span class="comment">// The intersection does not move along D2. Always projected on v(t)=vc. so if in [0,1], OK, else never collide.</span>
00496                 <span class="keywordflow">if</span>(vc&lt;0 || vc&gt;1)
00497                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
00498                 <span class="comment">// else suppose "always valid".</span>
00499                 tv0 =tv1= 0;
00500                 allV= <span class="keyword">true</span>;
00501         }
00502         <span class="keywordflow">else</span>
00503         {
00504                 tv0= (0-vc)/vv; <span class="comment">// t for v(t)=0</span>
00505                 tv1= (1-vc)/vv; <span class="comment">// t for v(t)=1</span>
00506         }
00507 
00508 
00509         <span class="comment">// clip intervals.</span>
00510         <span class="comment">// ===========================</span>
00511         <span class="comment">// order time interval.</span>
00512         <span class="keywordflow">if</span>(tu0&gt;tu1)
00513                 swap(tu0, tu1);         <span class="comment">// now, [tu0, tu1] represent the time interval where line D2 hit the edge D1.</span>
00514         <span class="keywordflow">if</span>(tv0&gt;tv1)
00515                 swap(tv0, tv1);         <span class="comment">// now, [tv0, tv1] represent the time interval where line D1 hit the edge D2.</span>
00516 
00517         normalOnBox= <span class="keyword">false</span>;
00518         <span class="keywordflow">if</span>(!allU &amp;&amp; !allV)
00519         {
00520                 <span class="comment">// if intervals do not overlap, no collision.</span>
00521                 <span class="keywordflow">if</span>(tu0&gt;tv1 || tv0&gt;tu1)
00522                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
00523                 <span class="keywordflow">else</span>
00524                 {
00525                         <span class="comment">// compute intersection of intervals.</span>
00526                         tMin= (<span class="keywordtype">float</span>)max(tu0, tv0);
00527                         tMax= (<span class="keywordtype">float</span>)<a class="code" href="a04061.html#a0">min</a>(tu1, tv1);
00528                         <span class="comment">// if collision of edgeCollide against the bbox.</span>
00529                         <span class="keywordflow">if</span>(tv0&gt;tu0)
00530                                 normalOnBox= <span class="keyword">true</span>;
00531                 }
00532         }
00533         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(allU)
00534         {
00535                 <span class="comment">// intersection of Infinite and V interval.</span>
00536                 tMin= (<span class="keywordtype">float</span>)tv0;
00537                 tMax= (<span class="keywordtype">float</span>)tv1;
00538                 <span class="comment">// if collision of edgeCollide against the bbox.</span>
00539                 normalOnBox= <span class="keyword">true</span>;
00540         }
00541         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(allV)
00542         {
00543                 <span class="comment">// intersection of Infinite and U interval.</span>
00544                 tMin= (<span class="keywordtype">float</span>)tu0;
00545                 tMax= (<span class="keywordtype">float</span>)tu1;
00546         }
00547         <span class="keywordflow">else</span>
00548         {
00549                 <span class="comment">// if allU &amp;&amp; allV, this means delta is near 0, and so there is always collision.</span>
00550                 tMin= -1000;
00551                 tMax= 1000;
00552         }
00553         
00554         <span class="keywordflow">return</span> <span class="keyword">true</span>;
00555 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodea5" doxytag="NLPACS::CEdgeCollide::testPointMove" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03305.html">CRational64</a> NLPACS::CEdgeCollide::testPointMove </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>start</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const <a class="el" href="a03660.html">CVector2f</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>end</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5">TPointMoveProblem</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>moveBug</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
return 1 either if no collision occurs. Else return a [0,1[ interval. return -1 if precision problem (see below). This method is used by <a class="el" href="a02588.html#NLPACS_1_1CGlobalRetrieverz1245_0">CGlobalRetriever::doMove()</a>. UnManageables cases arise when:<ul>
<li>the movement start/stop on a edge (dist==0). In this case, don't know on what surface we arrive (before or after).</li><li>the movement is // to the edge and collide with it. same problem than stop on an edge.</li><li>the movement traverse the edge on an endpoint. In this case, there is 2+ edges sharing the point, and result is undefined. On thoses cases, moveBug is filled, and -1 is returned.</li></ul>

<p>
Definition at line <a class="el" href="a05664.html#l00060">60</a> of file <a class="el" href="a05664.html">edge_collide.cpp</a>.
<p>
References <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0">EdgeNull</a>, <a class="el" href="a05587.html#l00094">NLMISC::fsgn()</a>, <a class="el" href="a05981.html#l00107">NL_I64</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1">ParallelEdges</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00101">sint64</a>, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3">StartOnEdge</a>, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4">StopOnEdge</a>, <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6">TraverseEndPoint</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>.
<p>
Referenced by <a class="el" href="a05761.html#l01649">NLPACS::CGlobalRetriever::testMovementWithCollisionChains()</a>.
<p>
<div class="fragment"><pre>00061 {
00062         <span class="comment">/*</span>
00063 <span class="comment">                To have a correct test (with no float precision problem):</span>
00064 <span class="comment">                        - test first if there is collision beetween the 2 edges:</span>
00065 <span class="comment">                                - test if first edge collide the other line.</span>
00066 <span class="comment">                                - test if second edge collide the other line.</span>
00067 <span class="comment">                                - if both true, yes, there is a collision.</span>
00068 <span class="comment">                        - compute time of collision.</span>
00069 <span class="comment">        */</span>
00070 
00071 
00072         <span class="comment">// *this must be a correct edge.</span>
00073         <span class="keywordflow">if</span>(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>==<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>)
00074         {
00075                 moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew0">EdgeNull</a>;
00076                 <span class="keywordflow">return</span> -1;
00077         }
00078 
00079         <span class="comment">// if no movement, no collision.</span>
00080         <span class="keywordflow">if</span>(start==end)
00081                 <span class="keywordflow">return</span> 1;
00082 
00083         <span class="comment">// NB those edges are snapped (1/256 for edgeCollide, and 1/1024 for start/end), so no float problem here.</span>
00084         <span class="comment">// precision is 20 bits.</span>
00085         CVector2f       normEdge;
00086         CVector2f       normMove;
00087         CVector2f       deltaEdge;
00088         CVector2f       deltaMove;
00089 
00090         <span class="comment">// compute normal of the edge (not normalized, because no need, and for precision problem).</span>
00091         deltaEdge= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>;
00092         normEdge.x= -deltaEdge.y;
00093         normEdge.y= deltaEdge.x;
00094 
00095         <span class="comment">// compute normal of the movement (not normalized, because no need, and for precision problem).</span>
00096         deltaMove= end-start;
00097         normMove.x= -deltaMove.y;
00098         normMove.y= deltaMove.x;
00099 
00100         <span class="comment">// distance from points of movment against edge line. Use double, because of multiplication.</span>
00101         <span class="comment">// precision is now 43 bits.</span>
00102         <span class="keywordtype">double</span>  moveD0= (<span class="keywordtype">double</span>)normEdge.x*(<span class="keywordtype">double</span>)(start.x-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x) + (<span class="keywordtype">double</span>)normEdge.y*(<span class="keywordtype">double</span>)(start.y-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y);
00103         <span class="keywordtype">double</span>  moveD1= (<span class="keywordtype">double</span>)normEdge.x*(<span class="keywordtype">double</span>)(end.x  -<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x) + (<span class="keywordtype">double</span>)normEdge.y*(<span class="keywordtype">double</span>)(end.y  -<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y);
00104 
00105         <span class="comment">// distance from points of edge against movement line. Use double, because of multiplication.</span>
00106         <span class="comment">// precision is now 43 bits.</span>
00107         <span class="keywordtype">double</span>  edgeD0= (<span class="keywordtype">double</span>)normMove.x*(<span class="keywordtype">double</span>)(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x-start.x) + (<span class="keywordtype">double</span>)normMove.y*(<span class="keywordtype">double</span>)(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y-start.y);
00108         <span class="keywordtype">double</span>  edgeD1= (<span class="keywordtype">double</span>)normMove.x*(<span class="keywordtype">double</span>)(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>.x-start.x) + (<span class="keywordtype">double</span>)normMove.y*(<span class="keywordtype">double</span>)(<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">P1</a>.y-start.y);
00109 
00110 
00111         <span class="comment">// If both edges intersect lines (including endpoints), there is a collision, else none.</span>
00112         <a class="code" href="a04558.html#a14">sint</a>    sgnMove0, sgnMove1;
00113         sgnMove0= <a class="code" href="a05378.html#a372">fsgn</a>(moveD0);
00114         sgnMove1= <a class="code" href="a05378.html#a372">fsgn</a>(moveD1);
00115 
00116         <span class="comment">// special case if the 2 edges lies on the same line.</span>
00117         <span class="keywordflow">if</span>(sgnMove0==0 &amp;&amp; sgnMove1==0)
00118         {
00119                 <span class="comment">// must test if there is a collision. if yes, problem.</span>
00120                 <span class="comment">// project all the points on the line of the edge.</span>
00121                 <span class="comment">// Use double because of multiplication. precision is now 43 bits.</span>
00122                 <span class="keywordtype">double</span>  moveA0= (<span class="keywordtype">double</span>)deltaEdge.x*(<span class="keywordtype">double</span>)(start.x-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x) + (<span class="keywordtype">double</span>)deltaEdge.y*(<span class="keywordtype">double</span>)(start.y-<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y);
00123                 <span class="keywordtype">double</span>  moveA1= (<span class="keywordtype">double</span>)deltaEdge.x*(<span class="keywordtype">double</span>)(end.x  -<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.x) + (<span class="keywordtype">double</span>)deltaEdge.y*(<span class="keywordtype">double</span>)(end.y  -<a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">P0</a>.y);
00124                 <span class="keywordtype">double</span>  edgeA0= 0;
00125                 <span class="keywordtype">double</span>  edgeA1= (<span class="keywordtype">double</span>)deltaEdge.x*(<span class="keywordtype">double</span>)deltaEdge.x + (<span class="keywordtype">double</span>)deltaEdge.y*(<span class="keywordtype">double</span>)deltaEdge.y;
00126 
00127                 <span class="comment">// Test is there is intersection (endpoints included). if yes, return -1. else return 1 (no collision at all).</span>
00128                 <span class="keywordflow">if</span>(moveA1&gt;=edgeA0 &amp;&amp; edgeA1&gt;=moveA0)
00129                 {
00130                         moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew1">ParallelEdges</a>;
00131                         <span class="keywordflow">return</span> -1;
00132                 }
00133                 <span class="keywordflow">else</span>
00134                         <span class="keywordflow">return</span> 1;
00135         }
00136 
00137         <span class="comment">// if on same side of the line=&gt; there is no collision.</span>
00138         <span class="keywordflow">if</span>( sgnMove0==sgnMove1)
00139                 <span class="keywordflow">return</span> 1;
00140 
00141         <span class="comment">// test edge against move line.</span>
00142         <a class="code" href="a04558.html#a14">sint</a>    sgnEdge0, sgnEdge1;
00143         sgnEdge0= <a class="code" href="a05378.html#a372">fsgn</a>(edgeD0);
00144         sgnEdge1= <a class="code" href="a05378.html#a372">fsgn</a>(edgeD1);
00145 
00146         <span class="comment">// should not have this case, because tested before with (sgnMove==0 &amp;&amp; sgnMove1==0).</span>
00147         <a class="code" href="a04199.html#a6">nlassert</a>(sgnEdge0!=0 || sgnEdge1!=0);
00148 
00149 
00150         <span class="comment">// if on same side of the line, no collision against this edge.</span>
00151         <span class="keywordflow">if</span>( sgnEdge0==sgnEdge1 )
00152                 <span class="keywordflow">return</span> 1;
00153 
00154         <span class="comment">// Here the edges intersect, but ensure that there is no limit problem.</span>
00155         <span class="keywordflow">if</span>(sgnEdge0==0 || sgnEdge1==0)
00156         {
00157                 moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew6">TraverseEndPoint</a>;
00158                 <span class="keywordflow">return</span> -1;
00159         }
00160         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(sgnMove1==0)
00161         {
00162                 moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew4">StopOnEdge</a>;
00163                 <span class="keywordflow">return</span> -1;
00164         }
00165         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(sgnMove0==0)
00166         {
00167                 <span class="comment">// this should not arrive.</span>
00168                 moveBug= <a class="code" href="a02448.html#NLPACS_1_1CEdgeCollideNodew5NLPACS_1_1CEdgeCollideNodew3">StartOnEdge</a>;
00169                 <span class="keywordflow">return</span> -1;
00170         }
00171 
00172 
00173         <span class="comment">// Here, there is a normal collision, just compute it.</span>
00174         <span class="comment">// Because of Division, there is a precision lost in double. So compute a CRational64.</span>
00175         <span class="comment">// First, compute numerator and denominator in the highest precision. this is 1024*1024 because of prec multiplication.</span>
00176         <span class="keywordtype">double</span>          numerator= (0-moveD0)*1024*1024;
00177         <span class="keywordtype">double</span>          denominator= (moveD1-moveD0)*1024*1024;
00178         <a class="code" href="a04558.html#a12">sint64</a>          numeratorInt= (<a class="code" href="a04558.html#a12">sint64</a>)numerator;
00179         <a class="code" href="a04558.html#a12">sint64</a>          denominatorInt= (<a class="code" href="a04558.html#a12">sint64</a>)denominator;
00180 <span class="comment">/*</span>
00181 <span class="comment">        nlassert(numerator == numeratorInt);</span>
00182 <span class="comment">        nlassert(denominator == denominatorInt);</span>
00183 <span class="comment">*/</span>
00184         <span class="keywordflow">if</span> (numerator != numeratorInt)
00185                 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"numerator(%f) != numeratorInt(%"</span>NL_I64<span class="stringliteral">"d)"</span>, numerator, numeratorInt);
00186         <span class="keywordflow">if</span> (denominator != denominatorInt)
00187                 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"denominator(%f) != denominatorInt(%"</span>NL_I64<span class="stringliteral">"d)"</span>, denominator, denominatorInt);
00188 
00189         <span class="keywordflow">return</span> CRational64(numeratorInt, denominatorInt);
00190 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo0" doxytag="NLPACS::CEdgeCollide::A0" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> float <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo0">NLPACS::CEdgeCollide::A0</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05665.html#l00190">190</a> of file <a class="el" href="a05665.html">edge_collide.h</a>.
<p>
Referenced by <a class="el" href="a05664.html#l00043">make()</a>, and <a class="el" href="a05664.html#l00265">testCircleMove()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo1" doxytag="NLPACS::CEdgeCollide::A1" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> float <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo1">NLPACS::CEdgeCollide::A1</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05665.html#l00190">190</a> of file <a class="el" href="a05665.html">edge_collide.h</a>.
<p>
Referenced by <a class="el" href="a05664.html#l00043">make()</a>, and <a class="el" href="a05664.html#l00265">testCircleMove()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo2" doxytag="NLPACS::CEdgeCollide::C" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> float <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo2">NLPACS::CEdgeCollide::C</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05665.html#l00191">191</a> of file <a class="el" href="a05665.html">edge_collide.h</a>.
<p>
Referenced by <a class="el" href="a05664.html#l00043">make()</a>, <a class="el" href="a05664.html#l00559">testBBoxMove()</a>, and <a class="el" href="a05664.html#l00265">testCircleMove()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo3" doxytag="NLPACS::CEdgeCollide::Dir" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03660.html">CVector2f</a> <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo3">NLPACS::CEdgeCollide::Dir</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05665.html#l00189">189</a> of file <a class="el" href="a05665.html">edge_collide.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo5" doxytag="NLPACS::CEdgeCollide::Norm" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03660.html">CVector2f</a> <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo5">NLPACS::CEdgeCollide::Norm</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05665.html#l00189">189</a> of file <a class="el" href="a05665.html">edge_collide.h</a>.
<p>
Referenced by <a class="el" href="a05664.html#l00043">make()</a>, <a class="el" href="a05664.html#l00559">testBBoxMove()</a>, <a class="el" href="a05664.html#l00265">testCircleMove()</a>, and <a class="el" href="a05761.html#l01649">NLPACS::CGlobalRetriever::testMovementWithCollisionChains()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo6" doxytag="NLPACS::CEdgeCollide::P0" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03660.html">CVector2f</a> <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo6">NLPACS::CEdgeCollide::P0</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05665.html#l00187">187</a> of file <a class="el" href="a05665.html">edge_collide.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLPACS_1_1CEdgeCollideNodeo7" doxytag="NLPACS::CEdgeCollide::P1" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03660.html">CVector2f</a> <a class="el" href="a02448.html#NLPACS_1_1CEdgeCollideNodeo7">NLPACS::CEdgeCollide::P1</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a05665.html#l00188">188</a> of file <a class="el" href="a05665.html">edge_collide.h</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a05665.html">edge_collide.h</a><li><a class="el" href="a05664.html">edge_collide.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 14:12:14 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>