mirror of https://github.com/CGAL/cgal
fixed demo slowness issue -- everything works as it used to
This commit is contained in:
parent
d3325162dd
commit
dc052fb5d5
|
|
@ -54,7 +54,7 @@ typedef Kernel::Point_2
|
|||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef Traits::Side_of_original_octagon Side_of_original_octagon;
|
||||
typedef Traits::Construct_hyperbolic_segment_2 Construct_hyperbolic_segment_2;
|
||||
typedef Traits::Construct_hyperbolic_line_2 Construct_hyperbolic_line_2;
|
||||
typedef Traits::Construct_inexact_intersection_2 Construct_inexact_intersection_2;
|
||||
typedef Triangulation::Hyperbolic_translation Hyperbolic_translation;
|
||||
typedef Triangulation::Locate_type Locate_type;
|
||||
typedef Triangulation::Face_handle Face_handle;
|
||||
|
|
@ -95,6 +95,7 @@ private:
|
|||
void animate();
|
||||
double updateTime();
|
||||
Point get_image(Point, Point, double);
|
||||
Circle_2 poincare;
|
||||
Face_handle last_location;
|
||||
double timestep;
|
||||
Hyperbolic_translation last_loc_translation;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
void
|
||||
MainWindow::initialize_animation_parameters() {
|
||||
|
||||
poincare = Circle_2(Point(0,0),1);
|
||||
timestep = 0.005;
|
||||
|
||||
std::srand(std::time(0));
|
||||
|
|
@ -18,10 +19,20 @@ MainWindow::initialize_animation_parameters() {
|
|||
ry2 = ((double)std::rand()/(double)RAND_MAX)*0.6;
|
||||
source = Point(rx1, ry1);
|
||||
target = Point(rx2, ry2);
|
||||
Segment_2 seg = Construct_hyperbolic_line_2()(source, target);
|
||||
Segment_2 seg = Construct_hyperbolic_segment_2()(source, target);
|
||||
Circular_arc_2* carc = boost::get<Circular_arc_2>(&seg);
|
||||
source = carc->source();
|
||||
target = carc->target();
|
||||
|
||||
source = carc->source();
|
||||
target = carc->target();
|
||||
|
||||
std::pair<Point,Point> inters = Construct_inexact_intersection_2()(carc->supporting_circle(), poincare);
|
||||
if (squared_distance(source, inters.first) < squared_distance(source, inters.second)) {
|
||||
source = inters.first;
|
||||
target = inters.second;
|
||||
} else {
|
||||
source = inters.second;
|
||||
target = inters.first;
|
||||
}
|
||||
|
||||
time = updateTime();
|
||||
last_location = dt.periodic_locate(get_image(source, target, time), last_loc_translation);
|
||||
|
|
@ -203,20 +214,24 @@ MainWindow::animate() {
|
|||
// The correct translation MUST have been identified now.
|
||||
CGAL_assertion(found);
|
||||
|
||||
std::cout << " ..making points..." << std::endl;
|
||||
source = Make_point()(source,o);
|
||||
target = Make_point()(target,o);
|
||||
|
||||
// Correct in case of wrong orientation.
|
||||
Segment_2 seg = Construct_hyperbolic_line_2()(source, target);
|
||||
std::cout << " ..making line..." << std::endl;
|
||||
Segment_2 seg = Construct_hyperbolic_segment_2()(source, target);
|
||||
Circular_arc_2* carc = boost::get<Circular_arc_2>(&seg);
|
||||
if (squared_distance(source, carc->source()) < squared_distance(source, carc->target())) {
|
||||
source = carc->source();
|
||||
target = carc->target();
|
||||
std::pair<Point,Point> inters = Construct_inexact_intersection_2()(carc->supporting_circle(), poincare);
|
||||
if (squared_distance(source, inters.first) < squared_distance(source, inters.second)) {
|
||||
source = inters.first;
|
||||
target = inters.second;
|
||||
} else {
|
||||
source = carc->target();
|
||||
target = carc->source();
|
||||
source = inters.second;
|
||||
target = inters.first;
|
||||
}
|
||||
|
||||
std::cout << " ..updating time for next iteration..." << std::endl;
|
||||
// Make sure the time is correct.
|
||||
time = updateTime();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ public:
|
|||
typedef typename Base::Construct_intersection_2 Construct_intersection_2;
|
||||
typedef typename Base::Construct_hyperbolic_segment_2 Construct_hyperbolic_segment_2;
|
||||
typedef typename Base::Construct_hyperbolic_bisector_2 Construct_hyperbolic_bisector_2;
|
||||
typedef typename Base::Construct_circle_or_line_supporting_bisector Construct_circle_or_line_supporting_bisector;
|
||||
typedef typename Base::Euclidean_collinear_2 Euclidean_collinear_2;
|
||||
typedef typename Base::Compute_squared_Euclidean_distance_2 Compute_squared_Euclidean_distance_2;
|
||||
typedef typename Base::Has_on_bounded_side_2 Has_on_bounded_side_2;
|
||||
|
|
@ -514,8 +515,8 @@ public:
|
|||
if (Compare_distance_2()(po,p,q) == EQUAL && Compare_distance_2()(po,p,r) == EQUAL )
|
||||
return po;
|
||||
|
||||
Euclidean_circle_or_line_2 bis_pq = typename Base::Construct_circle_or_line_supporting_bisector()(p,q);
|
||||
Euclidean_circle_or_line_2 bis_qr = typename Base::Construct_circle_or_line_supporting_bisector()(q,r);
|
||||
Euclidean_circle_or_line_2 bis_pq = Construct_circle_or_line_supporting_bisector()(p,q);
|
||||
Euclidean_circle_or_line_2 bis_qr = Construct_circle_or_line_supporting_bisector()(q,r);
|
||||
|
||||
// now supporting objects cannot both be Euclidean lines
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue