302{
303
304
305
306
307
308
309
313
316
317
318
319
320
321
322
323
324
325
331
333 {
334
335 v1 = (pt1 - pt3);
336
337
338 v2 = (pt2 - pt4);
339
340
341 }
342 else
343 {
344 v1 = pt1 - pt2;
345 v2 = pt3 - pt4;
346
347
348
349
350 }
351
352
353
354
355 v3 = v1 + v2 ;
356
357 smin = 1.0e8;
358 smax = -1.0e8;
359
360 G4double norm = std::sqrt(v3.
x() * v3.
x() + v3.
y() * v3.
y());
361 if(!norm)
362 {
363 G4cout <<
"\nNormal zero!";
364 G4cout <<
"\nLINE & DIR: " << line.
x() <<
" " << line.
y() <<
" " << dir;
366
368 line.
setX(-line.
x());
369 else
371 line.
setY(-line.
y());
372 else
373 {
374 G4cout <<
"\n RETURNING FROm CLIP..";
375 smin = 0; smax = 1; delete ch_tmp;
376 return;
377 }
378
379 G4cout <<
"\nCHANGED LINE & DIR: " << line.
x() <<
" "
380 << line.
y() <<
" " << dir;
381 }
382 else
383 {
384 line.
setX( v3.
y() / norm);
385 line.
setY(-v3.
x() / norm);
386 }
387
388
389
390
391
392
394 {
395
396 for(
G4int a = 0; a < col_size; a++)
397 {
398 ch_ptr =
new G4ConvexHull(a/(col_size - 1.0),1.0e8,-1.0e8);
399 if(! a)
400 {
401 ch_first=ch_ptr; delete ch_tmp;
402 }
404
405 ch_tmp=ch_ptr;
406 }
407
408 ch_ptr=ch_first;
410
411
412
413
414 for(
G4int h = 0; h < row_size; h++)
415 {
416 for(
G4int k = 0; k < col_size; k++)
417 {
418
419
420
421
423 value = - ((coordstmp.
x() * line.
x() + coordstmp.
y() * line.
y()));
424
427
429 }
430
431 ch_ptr=ch_first;
432 }
433
434 ch_ptr=ch_first;
435
436
437
438
439
440 for(
G4int l = 0; l < col_size - 1; l++)
441 {
443 for(
G4int q = l+1; q < col_size; q++)
444 {
445 register G4double d, param1, param2;
448
450 {
451 d = Findzero( param1, param2, ch_ptr->
GetMax(), ch_tmp->
GetMax());
454 }
455
457 {
458 d = Findzero( param1, param2, ch_ptr->
GetMin(), ch_tmp->
GetMin());
461 }
462
464 }
465
467 }
468
469 ch_ptr=ch_first;
470
471 if (smin <= 0.0) smin = 0.0;
472 if (smax >= 1.0) smax = 1.0;
473
474 if ( (ch_ptr)
475 && (Sign(ch_ptr->
GetMin()) != Sign(ch_ptr->
GetMax()))) smin = 0.0;
476
477 i = Sign(ch_tmp->
GetMin());
478 j = Sign(ch_tmp->
GetMax());
479
481
482
483 }
484 else
485 {
486 for(
G4int n = 0;
n < row_size;
n++)
487 {
488 ch_ptr =
new G4ConvexHull(n/(row_size - 1.0),1.0e8,-1.0e8);
489 if(!n)
490 {
491 ch_first=ch_ptr; delete ch_tmp;
492 }
494
495 ch_tmp=ch_ptr;
496 }
497
498 ch_ptr=ch_first;
499
500 for(
G4int o = 0; o < col_size; o++)
501 {
502 for(
G4int p = 0; p < row_size; p++)
503 {
505
506
507
508
509
511 value = - ((coordstmp.
x() * line.
x() + coordstmp.
y() * line.
y()));
512
515
517 }
518
519 ch_ptr=ch_first;
520 }
521
522 ch_ptr=ch_first;
523 delete ch_tmp;
524
525 for(
G4int q = 0; q < row_size - 1; q++)
526 {
528 for(
G4int r = q+1; r < row_size; r++)
529 {
533
535 {
536 d = Findzero( param1, param2, ch_ptr->
GetMax(), ch_tmp->
GetMax());
539 }
540
542 {
543 d = Findzero( param1, param2, ch_ptr->
GetMin(), ch_tmp->
GetMin());
546 }
547
549 }
550
552 }
553
554 ch_tmp=ch_ptr;
555 ch_ptr=ch_first;
556
557 if (smin <= 0.0) smin = 0.0;
558 if (smax >= 1.0) smax = 1.0;
559
560 if ( (ch_ptr)
561 && (Sign(ch_ptr->
GetMin()) != Sign(ch_ptr->
GetMax()))) smin = 0.0;
562
563 if ( ch_tmp )
564 {
565 i = Sign(ch_tmp->
GetMin());
566 j = Sign(ch_tmp->
GetMax());
568 }
569 }
570
571 ch_ptr=ch_first;
573 {
574 ch_tmp=ch_ptr;
576 delete ch_tmp;
577 }
578
579 delete ch_ptr;
580
581
583}
G4DLLIMPORT std::ostream G4cout
G4ConvexHull * GetNextHull()
G4double GetParam() const
void SetNextHull(G4ConvexHull *n)