New test for conic arcs.

This commit is contained in:
Shai Hirsch 2002-03-20 09:57:48 +00:00
parent e5db2e32b7
commit c7357d103c
11 changed files with 1070 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#include <CGAL/basic.h>
#include <CGAL/Cartesian.h>
// Making sure test doesn't fail if LEDA is not installed
#ifndef CGAL_USE_LEDA
int main(int argc, char* argv[])
{
std::cout << "A try to run test with LEDA traits but LEDA is not installed.";
std::cout << std::endl;
std::cout << "Test is not performed.";
std::cout << std::endl;
return 0;
}
#else
#include <CGAL/leda_real.h>
#include <CGAL/Arr_2_bases.h>
#include <CGAL/Arr_2_default_dcel.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_conic_traits_2.h>
#include "include/Conic_traits_test.h"
typedef leda_real NT;
typedef CGAL::Arr_conic_traits_2<NT> Traits;
int main (int argc, char** argv)
{
Conic_traits_test<Traits, NT> test_obj (argc, argv);
test_obj.start();
return (0);
}
#endif

View File

@ -0,0 +1,53 @@
#-----------------------------------------------------------
# Data block
#-----------------------------------------------------------
# Number of curves
5
# Curve #0: a segment
s -1 3 3 -1
# Curve #1: the upper part of the ellipse (x/3)^2 + (y/2)^2 = 1.
e 3 2 0 0 -3 0 3 0
# Curve #2: part of the upper portion of the right branch of the hyperbola
# (x/2)^2 - (y/1)^2 = 1
h 2 1 0 0 3 1.118034 2 0
# Curve #3: the upper part of the circle x^2 + y^2 = 2^2.
e 2 2 0 0 -2 0 2 0
# Curve #4: the lower part of the circle x^2 + (y-3)^2 = 1^2
e 1 1 0 3 1 3 -1 3
#-----------------------------------------------------------
# Number of "stand alone" points
5
-1 0 # 0
0 0 # 1
1 0 # 2
2 0 # 3
3 0 # 4
#-----------------------------------------------------------
# Execution block
#-----------------------------------------------------------
curve_compare_at_x 0 1 0 LARGER.
curve_compare_at_x 0 1 1 EQUAL.
curve_compare_at_x 0 1 2 SMALLER.
curve_compare_at_x 0 2 1 EQUAL. # Not in the x-range of curve 2.
curve_compare_at_x 0 2 3 EQUAL. # Intersection point.
curve_compare_at_x 0 2 4 SMALLER.
curve_compare_at_x_left 0 1 0 EQUAL. # Curve 0 not defined to the left.
curve_compare_at_x_left 0 1 1 LARGER.
curve_compare_at_x_left 0 2 3 EQUAL. # Curve 2 not defined to the left.
curve_compare_at_x_left 0 1 1 LARGER.
curve_compare_at_x_left 0 3 1 LARGER.
curve_compare_at_x_left 0 4 1 LARGER.
curve_compare_at_x_left 1 3 1 LARGER.
curve_compare_at_x_left 1 4 1 SMALLER.
curve_compare_at_x_left 3 4 1 SMALLER.
curve_compare_at_x_right 0 1 0 LARGER.
curve_compare_at_x_right 0 1 1 SMALLER.
curve_compare_at_x_right 0 2 3 SMALLER.
curve_compare_at_x_right 0 3 1 SMALLER.
curve_compare_at_x_right 0 4 1 SMALLER.
curve_compare_at_x_right 1 3 1 LARGER.
curve_compare_at_x_right 1 4 1 SMALLER.
curve_compare_at_x_right 3 4 1 SMALLER.

View File

@ -0,0 +1,84 @@
#-----------------------------------------------------------
# Data block
#-----------------------------------------------------------
# Number of curves (their clock-wise ordering is 0, 1, 2, ..., 7)
8
# Curve #0: a vertical segment
s 0 1 0 0
# Curve #1: part of the the right portion of the parabola y = x^2
a 1 0 0 0 -1 0 2 4 0 0
# Curve #2: the upper-right quarter of the circle x^2 + (y+1)^2 = 1^2
e 1 1 0 -1 0 0 1 -1
# Curve #3: a segment
s 0 0 2 -1
# Curve #4: a vertical segment
s 0 0 0 -3
# Curve #5: the upper-left quarter of the ellipse (x/3)^2 + (y+1)^2 = 1
e 3 1 0 -1 -3 -1 0 0
# Curve #6: a horizontal segment
s -2 0 0 0
# curve #7: a portion of the hyperbola y + 1 = 1/(x + 1)
a 0 0 1 1 1 0 -0.9 9 0 0
#-----------------------------------------------------------
# Number of "stand alone" points
1
0 0 # 0 (an endpoint of all curves)
#-----------------------------------------------------------
# Execution block
#-----------------------------------------------------------
curve_is_between_cw 2 0 4 0 TRUE. # Both cv1 and cv2 are vertical.
curve_is_between_cw 6 0 4 0 FALSE. # Both cv1 and cv2 are vertical.
curve_is_between_cw 1 0 2 0 TRUE. # cv1 is vertical (going up), cv2 right.
curve_is_between_cw 3 0 2 0 FALSE. # cv1 is vertical (going up), cv2 right.
curve_is_between_cw 3 0 6 0 TRUE. # cv1 is vertical (going up), cv2 left.
curve_is_between_cw 4 0 6 0 TRUE. # cv1 is vertical (going up), cv2 left.
curve_is_between_cw 7 0 6 0 FALSE. # cv1 is vertical (going up), cv2 left.
curve_is_between_cw 7 4 1 0 TRUE. # cv1 is vertical (going down), cv2 right.
curve_is_between_cw 0 4 1 0 TRUE. # cv1 is vertical (going down), cv2 right.
curve_is_between_cw 2 4 1 0 FALSE. # cv1 is vertical (going down), cv2 right.
curve_is_between_cw 6 4 7 0 TRUE. # cv1 is vertical (going down), cv2 left.
curve_is_between_cw 3 4 7 0 FALSE. # cv1 is vertical (going down), cv2 left.
curve_is_between_cw 3 2 0 0 TRUE. # cv2 is vertical (going up), cv1 right.
curve_is_between_cw 1 2 0 0 FALSE. # cv2 is vertical (going up), cv1 right.
curve_is_between_cw 4 2 0 0 TRUE. # cv2 is vertical (going up), cv1 right.
curve_is_between_cw 6 5 0 0 TRUE. # cv2 is vertical (going up), cv1 left.
curve_is_between_cw 1 5 0 0 FALSE. # cv2 is vertical (going up), cv1 left.
curve_is_between_cw 3 2 4 0 TRUE. # cv2 is vertical (going down), cv1 right.
curve_is_between_cw 6 2 4 0 FALSE. # cv2 is vertical (going down), cv1 right.
curve_is_between_cw 0 7 4 0 TRUE. # cv2 is vertical (going down), cv1 left.
curve_is_between_cw 1 7 4 0 TRUE. # cv2 is vertical (going down), cv1 left.
curve_is_between_cw 5 7 4 0 FALSE. # cv2 is vertical (going down), cv1 left.
curve_is_between_cw 0 1 2 0 FALSE. # cvx is vertical (going up)
curve_is_between_cw 0 1 5 0 FALSE. # cvx is vertical (going up)
curve_is_between_cw 0 5 2 0 TRUE. # cvx is vertical (going up)
curve_is_between_cw 0 7 6 0 TRUE. # cvx is vertical (going up)
curve_is_between_cw 4 1 2 0 FALSE. # cvx is vertical (going down)
curve_is_between_cw 4 1 5 0 TRUE. # cvx is vertical (going down)
curve_is_between_cw 4 5 2 0 FALSE. # cvx is vertical (going down)
curve_is_between_cw 4 7 6 0 TRUE. # cvx is vertical (going down)
curve_is_between_cw 6 5 7 0 TRUE. # cv1 left, cv2 left
curve_is_between_cw 2 5 7 0 FALSE. # cv1 left, cv2 left
curve_is_between_cw 1 7 5 0 TRUE. # cv1 left, cv2 left
curve_is_between_cw 6 7 5 0 FALSE. # cv1 left, cv2 left
curve_is_between_cw 2 1 3 0 TRUE. # cv1 right, cv2 right
curve_is_between_cw 5 1 3 0 FALSE. # cv1 right, cv2 right
curve_is_between_cw 7 3 1 0 TRUE. # cv1 right, cv2 right
curve_is_between_cw 2 3 1 0 FALSE. # cv1 right, cv2 right
curve_is_between_cw 7 6 1 0 TRUE. # cv1 left, cv2 right
curve_is_between_cw 5 7 2 0 FALSE. # cv1 left, cv2 right
curve_is_between_cw 2 5 3 0 TRUE. # cv1 left, cv2 right
curve_is_between_cw 2 5 1 0 FALSE. # cv1 left, cv2 right
curve_is_between_cw 5 1 6 0 TRUE. # cv1 right, cv2 left
curve_is_between_cw 3 2 7 0 TRUE. # cv1 right, cv2 left
curve_is_between_cw 1 3 5 0 FALSE. # cv1 right, cv2 left
curve_is_between_cw 6 1 5 0 FALSE. # cv1 right, cv2 left

View File

@ -0,0 +1,366 @@
#-----------------------------------------------------------
# Data block
#-----------------------------------------------------------
# Number of curves (their clock-wise ordering is 0, 1, 2, ..., 7)
8
# Curve #0: a vertical segment
s 0 1 0 0
# Curve #1: part of the the right portion of the parabola y = x^2
a 1 0 0 0 -1 0 2 4 0 0
# Curve #2: the upper-right quarter of the circle x^2 + (y+1)^2 = 1^2
e 1 1 0 -1 0 0 1 -1
# Curve #3: a segment
s 0 0 2 -1
# Curve #4: a vertical segment
s 0 0 0 -3
# Curve #5: the upper-left quarter of the ellipse (x/3)^2 + (y+1)^2 = 1
e 3 1 0 -1 -3 -1 0 0
# Curve #6: a horizontal segment
s -2 0 0 0
# curve #7: a portion of the hyperbola y + 1 = 1/(x + 1)
a 0 0 1 1 1 0 -0.9 9 0 0
#-----------------------------------------------------------
# Number of "stand alone" points
1
0 0 # 0 (an endpoint of all curves)
#-----------------------------------------------------------
# Execution block
#-----------------------------------------------------------
# The following test results were generated automatically, based on the
# assumption that the curves are ordered in a clock-wise manner.
curve_is_between_cw 2 0 1 0 FALSE.
curve_is_between_cw 3 0 1 0 FALSE.
curve_is_between_cw 4 0 1 0 FALSE.
curve_is_between_cw 5 0 1 0 FALSE.
curve_is_between_cw 6 0 1 0 FALSE.
curve_is_between_cw 7 0 1 0 FALSE.
curve_is_between_cw 1 0 2 0 TRUE.
curve_is_between_cw 3 0 2 0 FALSE.
curve_is_between_cw 4 0 2 0 FALSE.
curve_is_between_cw 5 0 2 0 FALSE.
curve_is_between_cw 6 0 2 0 FALSE.
curve_is_between_cw 7 0 2 0 FALSE.
curve_is_between_cw 1 0 3 0 TRUE.
curve_is_between_cw 2 0 3 0 TRUE.
curve_is_between_cw 4 0 3 0 FALSE.
curve_is_between_cw 5 0 3 0 FALSE.
curve_is_between_cw 6 0 3 0 FALSE.
curve_is_between_cw 7 0 3 0 FALSE.
curve_is_between_cw 1 0 4 0 TRUE.
curve_is_between_cw 2 0 4 0 TRUE.
curve_is_between_cw 3 0 4 0 TRUE.
curve_is_between_cw 5 0 4 0 FALSE.
curve_is_between_cw 6 0 4 0 FALSE.
curve_is_between_cw 7 0 4 0 FALSE.
curve_is_between_cw 1 0 5 0 TRUE.
curve_is_between_cw 2 0 5 0 TRUE.
curve_is_between_cw 3 0 5 0 TRUE.
curve_is_between_cw 4 0 5 0 TRUE.
curve_is_between_cw 6 0 5 0 FALSE.
curve_is_between_cw 7 0 5 0 FALSE.
curve_is_between_cw 1 0 6 0 TRUE.
curve_is_between_cw 2 0 6 0 TRUE.
curve_is_between_cw 3 0 6 0 TRUE.
curve_is_between_cw 4 0 6 0 TRUE.
curve_is_between_cw 5 0 6 0 TRUE.
curve_is_between_cw 7 0 6 0 FALSE.
curve_is_between_cw 1 0 7 0 TRUE.
curve_is_between_cw 2 0 7 0 TRUE.
curve_is_between_cw 3 0 7 0 TRUE.
curve_is_between_cw 4 0 7 0 TRUE.
curve_is_between_cw 5 0 7 0 TRUE.
curve_is_between_cw 6 0 7 0 TRUE.
curve_is_between_cw 2 1 0 0 TRUE.
curve_is_between_cw 3 1 0 0 TRUE.
curve_is_between_cw 4 1 0 0 TRUE.
curve_is_between_cw 5 1 0 0 TRUE.
curve_is_between_cw 6 1 0 0 TRUE.
curve_is_between_cw 7 1 0 0 TRUE.
curve_is_between_cw 0 1 2 0 FALSE.
curve_is_between_cw 3 1 2 0 FALSE.
curve_is_between_cw 4 1 2 0 FALSE.
curve_is_between_cw 5 1 2 0 FALSE.
curve_is_between_cw 6 1 2 0 FALSE.
curve_is_between_cw 7 1 2 0 FALSE.
curve_is_between_cw 0 1 3 0 FALSE.
curve_is_between_cw 2 1 3 0 TRUE.
curve_is_between_cw 4 1 3 0 FALSE.
curve_is_between_cw 5 1 3 0 FALSE.
curve_is_between_cw 6 1 3 0 FALSE.
curve_is_between_cw 7 1 3 0 FALSE.
curve_is_between_cw 0 1 4 0 FALSE.
curve_is_between_cw 2 1 4 0 TRUE.
curve_is_between_cw 3 1 4 0 TRUE.
curve_is_between_cw 5 1 4 0 FALSE.
curve_is_between_cw 6 1 4 0 FALSE.
curve_is_between_cw 7 1 4 0 FALSE.
curve_is_between_cw 0 1 5 0 FALSE.
curve_is_between_cw 2 1 5 0 TRUE.
curve_is_between_cw 3 1 5 0 TRUE.
curve_is_between_cw 4 1 5 0 TRUE.
curve_is_between_cw 6 1 5 0 FALSE.
curve_is_between_cw 7 1 5 0 FALSE.
curve_is_between_cw 0 1 6 0 FALSE.
curve_is_between_cw 2 1 6 0 TRUE.
curve_is_between_cw 3 1 6 0 TRUE.
curve_is_between_cw 4 1 6 0 TRUE.
curve_is_between_cw 5 1 6 0 TRUE.
curve_is_between_cw 7 1 6 0 FALSE.
curve_is_between_cw 0 1 7 0 FALSE.
curve_is_between_cw 2 1 7 0 TRUE.
curve_is_between_cw 3 1 7 0 TRUE.
curve_is_between_cw 4 1 7 0 TRUE.
curve_is_between_cw 5 1 7 0 TRUE.
curve_is_between_cw 6 1 7 0 TRUE.
curve_is_between_cw 1 2 0 0 FALSE.
curve_is_between_cw 3 2 0 0 TRUE.
curve_is_between_cw 4 2 0 0 TRUE.
curve_is_between_cw 5 2 0 0 TRUE.
curve_is_between_cw 6 2 0 0 TRUE.
curve_is_between_cw 7 2 0 0 TRUE.
curve_is_between_cw 0 2 1 0 TRUE.
curve_is_between_cw 3 2 1 0 TRUE.
curve_is_between_cw 4 2 1 0 TRUE.
curve_is_between_cw 5 2 1 0 TRUE.
curve_is_between_cw 6 2 1 0 TRUE.
curve_is_between_cw 7 2 1 0 TRUE.
curve_is_between_cw 0 2 3 0 FALSE.
curve_is_between_cw 1 2 3 0 FALSE.
curve_is_between_cw 4 2 3 0 FALSE.
curve_is_between_cw 5 2 3 0 FALSE.
curve_is_between_cw 6 2 3 0 FALSE.
curve_is_between_cw 7 2 3 0 FALSE.
curve_is_between_cw 0 2 4 0 FALSE.
curve_is_between_cw 1 2 4 0 FALSE.
curve_is_between_cw 3 2 4 0 TRUE.
curve_is_between_cw 5 2 4 0 FALSE.
curve_is_between_cw 6 2 4 0 FALSE.
curve_is_between_cw 7 2 4 0 FALSE.
curve_is_between_cw 0 2 5 0 FALSE.
curve_is_between_cw 1 2 5 0 FALSE.
curve_is_between_cw 3 2 5 0 TRUE.
curve_is_between_cw 4 2 5 0 TRUE.
curve_is_between_cw 6 2 5 0 FALSE.
curve_is_between_cw 7 2 5 0 FALSE.
curve_is_between_cw 0 2 6 0 FALSE.
curve_is_between_cw 1 2 6 0 FALSE.
curve_is_between_cw 3 2 6 0 TRUE.
curve_is_between_cw 4 2 6 0 TRUE.
curve_is_between_cw 5 2 6 0 TRUE.
curve_is_between_cw 7 2 6 0 FALSE.
curve_is_between_cw 0 2 7 0 FALSE.
curve_is_between_cw 1 2 7 0 FALSE.
curve_is_between_cw 3 2 7 0 TRUE.
curve_is_between_cw 4 2 7 0 TRUE.
curve_is_between_cw 5 2 7 0 TRUE.
curve_is_between_cw 6 2 7 0 TRUE.
curve_is_between_cw 1 3 0 0 FALSE.
curve_is_between_cw 2 3 0 0 FALSE.
curve_is_between_cw 4 3 0 0 TRUE.
curve_is_between_cw 5 3 0 0 TRUE.
curve_is_between_cw 6 3 0 0 TRUE.
curve_is_between_cw 7 3 0 0 TRUE.
curve_is_between_cw 0 3 1 0 TRUE.
curve_is_between_cw 2 3 1 0 FALSE.
curve_is_between_cw 4 3 1 0 TRUE.
curve_is_between_cw 5 3 1 0 TRUE.
curve_is_between_cw 6 3 1 0 TRUE.
curve_is_between_cw 7 3 1 0 TRUE.
curve_is_between_cw 0 3 2 0 TRUE.
curve_is_between_cw 1 3 2 0 TRUE.
curve_is_between_cw 4 3 2 0 TRUE.
curve_is_between_cw 5 3 2 0 TRUE.
curve_is_between_cw 6 3 2 0 TRUE.
curve_is_between_cw 7 3 2 0 TRUE.
curve_is_between_cw 0 3 4 0 FALSE.
curve_is_between_cw 1 3 4 0 FALSE.
curve_is_between_cw 2 3 4 0 FALSE.
curve_is_between_cw 5 3 4 0 FALSE.
curve_is_between_cw 6 3 4 0 FALSE.
curve_is_between_cw 7 3 4 0 FALSE.
curve_is_between_cw 0 3 5 0 FALSE.
curve_is_between_cw 1 3 5 0 FALSE.
curve_is_between_cw 2 3 5 0 FALSE.
curve_is_between_cw 4 3 5 0 TRUE.
curve_is_between_cw 6 3 5 0 FALSE.
curve_is_between_cw 7 3 5 0 FALSE.
curve_is_between_cw 0 3 6 0 FALSE.
curve_is_between_cw 1 3 6 0 FALSE.
curve_is_between_cw 2 3 6 0 FALSE.
curve_is_between_cw 4 3 6 0 TRUE.
curve_is_between_cw 5 3 6 0 TRUE.
curve_is_between_cw 7 3 6 0 FALSE.
curve_is_between_cw 0 3 7 0 FALSE.
curve_is_between_cw 1 3 7 0 FALSE.
curve_is_between_cw 2 3 7 0 FALSE.
curve_is_between_cw 4 3 7 0 TRUE.
curve_is_between_cw 5 3 7 0 TRUE.
curve_is_between_cw 6 3 7 0 TRUE.
curve_is_between_cw 1 4 0 0 FALSE.
curve_is_between_cw 2 4 0 0 FALSE.
curve_is_between_cw 3 4 0 0 FALSE.
curve_is_between_cw 5 4 0 0 TRUE.
curve_is_between_cw 6 4 0 0 TRUE.
curve_is_between_cw 7 4 0 0 TRUE.
curve_is_between_cw 0 4 1 0 TRUE.
curve_is_between_cw 2 4 1 0 FALSE.
curve_is_between_cw 3 4 1 0 FALSE.
curve_is_between_cw 5 4 1 0 TRUE.
curve_is_between_cw 6 4 1 0 TRUE.
curve_is_between_cw 7 4 1 0 TRUE.
curve_is_between_cw 0 4 2 0 TRUE.
curve_is_between_cw 1 4 2 0 TRUE.
curve_is_between_cw 3 4 2 0 FALSE.
curve_is_between_cw 5 4 2 0 TRUE.
curve_is_between_cw 6 4 2 0 TRUE.
curve_is_between_cw 7 4 2 0 TRUE.
curve_is_between_cw 0 4 3 0 TRUE.
curve_is_between_cw 1 4 3 0 TRUE.
curve_is_between_cw 2 4 3 0 TRUE.
curve_is_between_cw 5 4 3 0 TRUE.
curve_is_between_cw 6 4 3 0 TRUE.
curve_is_between_cw 7 4 3 0 TRUE.
curve_is_between_cw 0 4 5 0 FALSE.
curve_is_between_cw 1 4 5 0 FALSE.
curve_is_between_cw 2 4 5 0 FALSE.
curve_is_between_cw 3 4 5 0 FALSE.
curve_is_between_cw 6 4 5 0 FALSE.
curve_is_between_cw 7 4 5 0 FALSE.
curve_is_between_cw 0 4 6 0 FALSE.
curve_is_between_cw 1 4 6 0 FALSE.
curve_is_between_cw 2 4 6 0 FALSE.
curve_is_between_cw 3 4 6 0 FALSE.
curve_is_between_cw 5 4 6 0 TRUE.
curve_is_between_cw 7 4 6 0 FALSE.
curve_is_between_cw 0 4 7 0 FALSE.
curve_is_between_cw 1 4 7 0 FALSE.
curve_is_between_cw 2 4 7 0 FALSE.
curve_is_between_cw 3 4 7 0 FALSE.
curve_is_between_cw 5 4 7 0 TRUE.
curve_is_between_cw 6 4 7 0 TRUE.
curve_is_between_cw 1 5 0 0 FALSE.
curve_is_between_cw 2 5 0 0 FALSE.
curve_is_between_cw 3 5 0 0 FALSE.
curve_is_between_cw 4 5 0 0 FALSE.
curve_is_between_cw 6 5 0 0 TRUE.
curve_is_between_cw 7 5 0 0 TRUE.
curve_is_between_cw 0 5 1 0 TRUE.
curve_is_between_cw 2 5 1 0 FALSE.
curve_is_between_cw 3 5 1 0 FALSE.
curve_is_between_cw 4 5 1 0 FALSE.
curve_is_between_cw 6 5 1 0 TRUE.
curve_is_between_cw 7 5 1 0 TRUE.
curve_is_between_cw 0 5 2 0 TRUE.
curve_is_between_cw 1 5 2 0 TRUE.
curve_is_between_cw 3 5 2 0 FALSE.
curve_is_between_cw 4 5 2 0 FALSE.
curve_is_between_cw 6 5 2 0 TRUE.
curve_is_between_cw 7 5 2 0 TRUE.
curve_is_between_cw 0 5 3 0 TRUE.
curve_is_between_cw 1 5 3 0 TRUE.
curve_is_between_cw 2 5 3 0 TRUE.
curve_is_between_cw 4 5 3 0 FALSE.
curve_is_between_cw 6 5 3 0 TRUE.
curve_is_between_cw 7 5 3 0 TRUE.
curve_is_between_cw 0 5 4 0 TRUE.
curve_is_between_cw 1 5 4 0 TRUE.
curve_is_between_cw 2 5 4 0 TRUE.
curve_is_between_cw 3 5 4 0 TRUE.
curve_is_between_cw 6 5 4 0 TRUE.
curve_is_between_cw 7 5 4 0 TRUE.
curve_is_between_cw 0 5 6 0 FALSE.
curve_is_between_cw 1 5 6 0 FALSE.
curve_is_between_cw 2 5 6 0 FALSE.
curve_is_between_cw 3 5 6 0 FALSE.
curve_is_between_cw 4 5 6 0 FALSE.
curve_is_between_cw 7 5 6 0 FALSE.
curve_is_between_cw 0 5 7 0 FALSE.
curve_is_between_cw 1 5 7 0 FALSE.
curve_is_between_cw 2 5 7 0 FALSE.
curve_is_between_cw 3 5 7 0 FALSE.
curve_is_between_cw 4 5 7 0 FALSE.
curve_is_between_cw 6 5 7 0 TRUE.
curve_is_between_cw 1 6 0 0 FALSE.
curve_is_between_cw 2 6 0 0 FALSE.
curve_is_between_cw 3 6 0 0 FALSE.
curve_is_between_cw 4 6 0 0 FALSE.
curve_is_between_cw 5 6 0 0 FALSE.
curve_is_between_cw 7 6 0 0 TRUE.
curve_is_between_cw 0 6 1 0 TRUE.
curve_is_between_cw 2 6 1 0 FALSE.
curve_is_between_cw 3 6 1 0 FALSE.
curve_is_between_cw 4 6 1 0 FALSE.
curve_is_between_cw 5 6 1 0 FALSE.
curve_is_between_cw 7 6 1 0 TRUE.
curve_is_between_cw 0 6 2 0 TRUE.
curve_is_between_cw 1 6 2 0 TRUE.
curve_is_between_cw 3 6 2 0 FALSE.
curve_is_between_cw 4 6 2 0 FALSE.
curve_is_between_cw 5 6 2 0 FALSE.
curve_is_between_cw 7 6 2 0 TRUE.
curve_is_between_cw 0 6 3 0 TRUE.
curve_is_between_cw 1 6 3 0 TRUE.
curve_is_between_cw 2 6 3 0 TRUE.
curve_is_between_cw 4 6 3 0 FALSE.
curve_is_between_cw 5 6 3 0 FALSE.
curve_is_between_cw 7 6 3 0 TRUE.
curve_is_between_cw 0 6 4 0 TRUE.
curve_is_between_cw 1 6 4 0 TRUE.
curve_is_between_cw 2 6 4 0 TRUE.
curve_is_between_cw 3 6 4 0 TRUE.
curve_is_between_cw 5 6 4 0 FALSE.
curve_is_between_cw 7 6 4 0 TRUE.
curve_is_between_cw 0 6 5 0 TRUE.
curve_is_between_cw 1 6 5 0 TRUE.
curve_is_between_cw 2 6 5 0 TRUE.
curve_is_between_cw 3 6 5 0 TRUE.
curve_is_between_cw 4 6 5 0 TRUE.
curve_is_between_cw 7 6 5 0 TRUE.
curve_is_between_cw 0 6 7 0 FALSE.
curve_is_between_cw 1 6 7 0 FALSE.
curve_is_between_cw 2 6 7 0 FALSE.
curve_is_between_cw 3 6 7 0 FALSE.
curve_is_between_cw 4 6 7 0 FALSE.
curve_is_between_cw 5 6 7 0 FALSE.
curve_is_between_cw 1 7 0 0 FALSE.
curve_is_between_cw 2 7 0 0 FALSE.
curve_is_between_cw 3 7 0 0 FALSE.
curve_is_between_cw 4 7 0 0 FALSE.
curve_is_between_cw 5 7 0 0 FALSE.
curve_is_between_cw 6 7 0 0 FALSE.
curve_is_between_cw 0 7 1 0 TRUE.
curve_is_between_cw 2 7 1 0 FALSE.
curve_is_between_cw 3 7 1 0 FALSE.
curve_is_between_cw 4 7 1 0 FALSE.
curve_is_between_cw 5 7 1 0 FALSE.
curve_is_between_cw 6 7 1 0 FALSE.
curve_is_between_cw 0 7 2 0 TRUE.
curve_is_between_cw 1 7 2 0 TRUE.
curve_is_between_cw 3 7 2 0 FALSE.
curve_is_between_cw 4 7 2 0 FALSE.
curve_is_between_cw 5 7 2 0 FALSE.
curve_is_between_cw 6 7 2 0 FALSE.
curve_is_between_cw 0 7 3 0 TRUE.
curve_is_between_cw 1 7 3 0 TRUE.
curve_is_between_cw 2 7 3 0 TRUE.
curve_is_between_cw 4 7 3 0 FALSE.
curve_is_between_cw 5 7 3 0 FALSE.
curve_is_between_cw 6 7 3 0 FALSE.
curve_is_between_cw 0 7 4 0 TRUE.
curve_is_between_cw 1 7 4 0 TRUE.
curve_is_between_cw 2 7 4 0 TRUE.
curve_is_between_cw 3 7 4 0 TRUE.
curve_is_between_cw 5 7 4 0 FALSE.
curve_is_between_cw 6 7 4 0 FALSE.
curve_is_between_cw 0 7 5 0 TRUE.
curve_is_between_cw 1 7 5 0 TRUE.
curve_is_between_cw 2 7 5 0 TRUE.
curve_is_between_cw 3 7 5 0 TRUE.
curve_is_between_cw 4 7 5 0 TRUE.
curve_is_between_cw 6 7 5 0 FALSE.
curve_is_between_cw 0 7 6 0 TRUE.
curve_is_between_cw 1 7 6 0 TRUE.
curve_is_between_cw 2 7 6 0 TRUE.
curve_is_between_cw 3 7 6 0 TRUE.
curve_is_between_cw 4 7 6 0 TRUE.
curve_is_between_cw 5 7 6 0 TRUE.

View File

@ -0,0 +1,56 @@
#-----------------------------------------------------------
# Data block
#-----------------------------------------------------------
# Number of curves
5
# Curve #0: the upper-right portion of the ellipse (x/5)^2 + (y/3)^2 = 1
e 5 3 0 0 0 3 5 0
# Curve #1: a segment
s -1 3 2 4
# Curve #2: a vertical segment
s 0 1 0 0
# Curve #3: a portion of the hyperbola y = 1/x
a 0 0 1 0 0 -1 0.1 10 2 0.5
# Curve #4: a portion of the parabola y = 3*x^2 - 2*x + 5
a 3 0 0 -2 -1 5 2 13 -1 10
#-----------------------------------------------------------
# Number of "stand alone" points
9
-2 0 # 0
-1 0 # 1
0 0 # 2
1 0 # 3
2 0 # 4
3 0 # 5
4 0 # 6
5 0 # 7
6 0 # 8
#-----------------------------------------------------------
# Execution block
#-----------------------------------------------------------
curve_is_in_x_range 0 1 FALSE.
curve_is_in_x_range 0 2 TRUE.
curve_is_in_x_range 0 4 TRUE.
curve_is_in_x_range 0 7 TRUE.
curve_is_in_x_range 0 8 FALSE.
curve_is_in_x_range 1 0 FALSE.
curve_is_in_x_range 1 1 TRUE.
curve_is_in_x_range 1 2 TRUE.
curve_is_in_x_range 1 4 TRUE.
curve_is_in_x_range 1 5 FALSE.
curve_is_in_x_range 2 1 FALSE.
curve_is_in_x_range 2 2 TRUE.
curve_is_in_x_range 2 3 FALSE.
curve_is_in_x_range 3 2 FALSE.
curve_is_in_x_range 3 3 TRUE.
curve_is_in_x_range 3 4 TRUE.
curve_is_in_x_range 3 5 FALSE.
curve_is_in_x_range 4 0 FALSE.
curve_is_in_x_range 4 1 TRUE.
curve_is_in_x_range 4 3 TRUE.
curve_is_in_x_range 4 4 TRUE.
curve_is_in_x_range 4 6 FALSE.

View File

@ -0,0 +1,30 @@
#-----------------------------------------------------------
# Data block
#-----------------------------------------------------------
5
# Curve #0: the upper portion of the ellipse (x/5)^2 + (y/3)^2 = 1
e 5 3 0 0 -5 0 5 0
# Curve #1: a segment
s -1 3 3 -1
# Curve #2: a vertical segment
s 0 -2 0 0
# Curve #3: a portion of the hyperbola y = 1/x
a 0 0 1 0 0 -1 0.1 10 2 0.5
# Curve #4: a portion of the parabola y = 3*x^2 - 2*x + 5
a 3 0 0 -2 -1 5 2 13 -1 10
#-----------------------------------------------------------
# Number of "stand alone" points
5
0 3 # 0
0 2 # 1
0 -1 # 2
1 1 # 3
1 6 # 4
#-----------------------------------------------------------
# Execution block
#-----------------------------------------------------------
curve_split 0 0.
curve_split 1 1.
curve_split 2 2.
curve_split 3 3.
curve_split 4 4.

View File

@ -0,0 +1,55 @@
#-----------------------------------------------------------
# Data block
#-----------------------------------------------------------
# Number of curves
7
# Curve #0: a segment
s -1 3 3 -1
# Curve #1: the upper part of the ellipse (x/3)^2 + (y/2)^2 = 1.
e 3 2 0 0 -3 0 3 0
# Curve #2: a portion of the parabola y = -x^2 + 2*x + 2
a -1 0 0 2 -1 2 4 -6 2 2
# Curve #3: the upper part of the circle x^2 + y^2 = 2^2
e 2 2 0 0 -2 0 2 0
# Curve #4: a portion of the parabola y = x^2 - 5*x + 5
a 1 0 0 -5 -1 5 4 1 1 1
# Curve #5: a vertical segment
s 0 1 0 0
# Curve #6: a vertical segment
s 3 2 3 -2
#-----------------------------------------------------------
# Number of "stand alone" points
5
-1 0 # 0
1 0 # 1
5 0 # 2
3 -1 # 3
3 0 # 4
#-----------------------------------------------------------
# Execution block
#-----------------------------------------------------------
do_intersect_to_right 0 1 0 TRUE.
do_intersect_to_right 0 3 0 TRUE.
do_intersect_to_right 1 3 0 TRUE.
do_intersect_to_right 4 1 0 FALSE.
do_intersect_to_right 0 1 1 FALSE.
do_intersect_to_right 0 3 1 TRUE.
do_intersect_to_right 1 3 1 FALSE.
do_intersect_to_right 0 5 0 FALSE.
do_intersect_to_right 1 5 0 FALSE.
do_intersect_to_right 1 6 3 TRUE.
do_intersect_to_right 1 6 4 FALSE.
do_intersect_to_right 0 2 1 TRUE.
do_intersect_to_right 0 4 1 TRUE.
do_intersect_to_right 0 6 1 TRUE.
do_intersect_to_right 2 4 1 TRUE.
do_intersect_to_right 4 6 1 TRUE.
do_intersect_to_right 0 2 2 FALSE.
do_intersect_to_right 0 4 2 FALSE.
do_intersect_to_right 0 6 2 FALSE.
do_intersect_to_right 2 4 2 FALSE.
do_intersect_to_right 4 6 2 FALSE.

View File

@ -0,0 +1,53 @@
#-----------------------------------------------------------
# Data block
#-----------------------------------------------------------
5
# Curve #0: the upper portion of the ellipse (x/5)^2 + (y/3)^2 = 1
e 5 3 0 0 -5 0 5 0
# Curve #1: a segment
s -1 3 3 -1
# Curve #2: a vertical segment
s 0 -2 0 0
# Curve #3: a portion of the hyperbola y = 1/x
a 0 0 1 0 0 -1 0.1 10 2 0.5
# Curve #4: a portion of the parabola y = 3*x^2 - 2*x + 5
a 3 0 0 -2 -1 5 2 13 -1 10
#-----------------------------------------------------------
# Number of "stand alone" points
9
0 3 # 0
1 1 # 1
1 3 # 2
6 0 # 3
1 0 # 4
0 -1 # 5
0 -3 # 6
1 6 # 7
1 7 # 8
#-----------------------------------------------------------
# Execution block
#-----------------------------------------------------------
curve_get_point_status 0 0 ON_CURVE.
curve_get_point_status 0 1 UNDER_CURVE.
curve_get_point_status 0 2 ABOVE_CURVE.
curve_get_point_status 0 3 CURVE_NOT_IN_RANGE.
curve_get_point_status 1 0 ABOVE_CURVE.
curve_get_point_status 1 1 ON_CURVE.
curve_get_point_status 1 4 UNDER_CURVE.
curve_get_point_status 0 3 CURVE_NOT_IN_RANGE.
curve_get_point_status 2 0 ABOVE_CURVE.
curve_get_point_status 2 5 ON_CURVE.
curve_get_point_status 2 6 UNDER_CURVE.
curve_get_point_status 2 4 CURVE_NOT_IN_RANGE.
curve_get_point_status 3 2 ABOVE_CURVE.
curve_get_point_status 3 1 ON_CURVE.
curve_get_point_status 3 4 UNDER_CURVE.
curve_get_point_status 3 0 CURVE_NOT_IN_RANGE.
curve_get_point_status 4 8 ABOVE_CURVE.
curve_get_point_status 4 7 ON_CURVE.
curve_get_point_status 4 5 UNDER_CURVE.
curve_get_point_status 4 3 CURVE_NOT_IN_RANGE.

View File

@ -0,0 +1,38 @@
#-----------------------------------------------------------
# Data block
#-----------------------------------------------------------
# Number of curves
7
# Curve #0: a segment
s -1 3 3 -1
# Curve #1: the upper part of the ellipse (x/3)^2 + (y/2)^2 = 1.
e 3 2 0 0 -3 0 3 0
# Curve #2: a portion of the parabola y = -x^2 + 2*x + 2
a -1 0 0 2 -1 2 4 -6 2 2
# Curve #3: the upper part of the circle x^2 + y^2 = 2^2
e 2 2 0 0 -2 0 2 0
# Curve #4: a portion of the parabola y = x^2 - 5*x + 5
a 1 0 0 -5 -1 5 4 1 1 1
# Curve #5: a vertical segment
s 0 1 0 0
# Curve #6: a vertical segment
s 3 2 3 -2
#-----------------------------------------------------------
# Number of "stand alone" points
3
-1 0 # 0
1 0 # 1
2 0 # 2
#-----------------------------------------------------------
# Execution block
#-----------------------------------------------------------
nearest_intersection_to_right 0 1 0 0 2 0 2 TRUE.
nearest_intersection_to_right 0 3 0 0 2 0 2 TRUE.
nearest_intersection_to_right 1 3 0 0 2 0 2 TRUE.
nearest_intersection_to_right 0 3 1 2 0 2 0 TRUE.
nearest_intersection_to_right 0 2 1 3 -1 3 -1 TRUE.
nearest_intersection_to_right 0 4 1 1 1 1 1 TRUE.
nearest_intersection_to_right 0 4 2 3 -1 3 -1 TRUE.
nearest_intersection_to_right 0 6 1 3 -1 3 -1 TRUE.
nearest_intersection_to_right 2 4 1 3 -1 3 -1 TRUE.
nearest_intersection_to_right 4 6 1 3 -1 3 -1 TRUE.

View File

@ -80,6 +80,7 @@ else
compile_and_run Arr_leda_polyline_traits_test polylines
compile_and_run Arr_segment_circle_traits_test segment_circles
compile_and_run Arr_circles_real_traits_test circular_arcs
compile_and_run Arr_conic_traits_test conic_arcs
fi

View File

@ -0,0 +1,297 @@
#ifndef CGAL_CONIC_TRAITS_TEST_H
#define CGAL_CONIC_TRAITS_TEST_H
#include "Base_traits_test.h"
#include <list>
static const double _error_eps = 0.001;
template <class Traits_class, class Number_type>
class Conic_traits_test :
public Base_traits_test<Traits_class, Number_type>
{
public:
typedef Number_type NT;
typedef typename Traits_class::Point Point;
typedef typename Traits_class::X_curve X_curve;
typedef typename Traits_class::Curve Curve;
typedef typename Traits_class::Conic Conic;
public:
// Constructor.
Conic_traits_test (int argc, char** argv) :
Base_traits_test<Traits_class, Number_type>(argc, argv)
{}
// Destructor.
virtual ~Conic_traits_test()
{}
// Read a curve.
virtual void read_curve (ifstream& is, Curve& cv);
// Test the make_x_monotone function.
virtual bool make_x_monotone_wrapper (istrstream& str_line);
// Test the curve_split function.
virtual bool curve_split_wrapper (istrstream& str_line);
};
//---------------------------------------------------------------------
// Read a curve. This method is called by collect_data.
//
template <class Traits_class, class Number_type>
void Conic_traits_test<Traits_class, Number_type>::
read_curve (ifstream& is, Curve& cv)
{
// Read a line from the input file.
char one_line[128];
skip_comments (is, one_line);
istrstream str_line( one_line, 128 );
// Get the arc type.
char type;
Conic conic;
str_line >> type;
// An ellipse (full ellipse or a partial ellipse):
if (type == 'f' || type == 'F' || type == 'e' || type == 'E')
{
// Read the ellipse (using the format "a b x0 y0"):
//
// x - x0 2 y - y0 2
// ( -------- ) + ( -------- ) = 1
// a b
//
NT a, b, x0, y0;
str_line >> a >> b >> x0 >> y0;
NT a_sq = a*a;
NT b_sq = b*b;
conic = Conic (b_sq, a_sq, 0,
-2*x0*b_sq, -2*y0*a_sq,
x0*x0*b_sq + y0*y0*a_sq - a_sq*b_sq);
if (type == 'f' || type == 'F')
{
// Create a full ellipse.
cv = Curve(conic);
return;
}
}
else if (type == 'h' || type == 'H')
{
// Read the hyperbola (using the format "a b x0 y0"):
//
// x - x0 2 y - y0 2
// ( -------- ) - ( -------- ) = 1
// a b
//
NT a, b, x0, y0;
str_line >> a >> b >> x0 >> y0;
NT a_sq = a*a;
NT b_sq = b*b;
conic = Conic (b_sq, -a_sq, 0,
-2*x0*b_sq, 2*y0*a_sq,
x0*x0*b_sq - y0*y0*a_sq - a_sq*b_sq);
}
else if (type == 'p' || type == 'P')
{
// Read the parabola (using the format "c x0 y0"):
//
// 2
// 4c*(y - y0) = (x - x0)
//
NT c, x0, y0;
str_line >> c >> x0 >> y0;
conic = Conic (1, 0, 0,
-2*x0, -4*c,
x0*x0 + 4*c*y0);
}
else if (type == 'c' || type == 'C' || type == 'a' || type == 'A')
{
// Read a general conic, given by its coefficients <r,s,t,u,v,w>.
NT r, s, t, u, v, w;
str_line >> r >> s >> t >> u >> v >> w;
conic = Conic (r, s, t, u, v, w);
if (type == 'c' || type == 'C')
{
// Create a full conic (should work only for ellipses).
cv = Curve(conic);
return;
}
}
else if (type == 's' || type == 'S')
{
// Read a segment, given by its endpoints (x1,y1) and (x2,y2);
NT x1, y1, x2, y2;
str_line >> x1 >> y1 >> x2 >> y2;
conic = Conic (0, 0, 0,
y1 - y2, x2 - x1,
x1*y2 - x2*y1);
// Create the segment.
cv = Curve(conic, Point(x1,y1), Point(x2,y2));
return;
}
else
{
cerr << "Illegal conic type specification: " << type << "." << endl;
return;
}
// Read the end points of the arc and create it.
NT x1, y1, x2, y2;
str_line >> x1 >> y1 >> x2 >> y2;
Point source (x1, y1);
Point target (x2, y2);
// Create the circular arc.
cv = Curve (conic,
source, target,
_error_eps); // It's OK to move the endpoints a bit.
return;
}
//---------------------------------------------------------------------
// Test the make_x_monotone function.
// Input case: make_x_monotone n1 n2, where:
// n1 - curve index in all_curves_vec
// n2 - number of expected X-monotonian subcurves
//
template<class Traits_class, class Number_type>
bool Conic_traits_test<Traits_class, Number_type>::
make_x_monotone_wrapper (istrstream& str_line)
{
// Read the inputs.
int cv_index;
int n_exp_curves;
str_line >> cv_index >> n_exp_curves;
cout << "Test: make_x_monotone( Curve" << cv_index << " ) ? " << endl;
// Make x-monotone !
list<X_curve> x_curves;
tr.make_x_monotone (all_curves_vec[cv_index], x_curves);
int n_act_curves = static_cast<int>(x_curves.size());
if (n_act_curves == n_exp_curves)
{
cout << "Was successful" << endl;
return (true);
}
else
{
cout << "Was NOT successful" << endl;
cout << "Expected " << n_exp_curves << " x-monotone curves, "
<< "recieved " << n_act_curves << endl;
return (false);
}
}
//---------------------------------------------------------------------
// Test the curve_split function.
// Input case: curve_split n1 n2, where:
// n1 - curve index in all_curves_vec
// n2 - point index in all_points_vec
// Does NOT take any expected result.
//
template<class Traits_class, class Number_type>
bool Conic_traits_test<Traits_class, Number_type>::
curve_split_wrapper (istrstream& str_line)
{
// Read the inputs.
int cv_index, pt_index;
str_line >> cv_index >> pt_index;
cout << "Test: curve_split( Curve" << cv_index
<< ", " << all_points_vec[pt_index]
<< " ) ? " << endl;
// Check some preconditions.
if (! tr.is_x_monotone(all_curves_vec[cv_index]))
{
cout << "Was NOT successful" << endl;
cout << "Precondition fault: Input curve is not x-monotone" << endl;
return (false);
}
if (tr.curve_get_point_status (all_curves_vec[cv_index],
all_points_vec[pt_index]) != tr.ON_CURVE)
{
cout << "Was NOT successful" << endl;
cout << "Precondition fault: Split point is not on the curve" << endl;
return (false);
}
if (all_curves_vec[cv_index].source() == all_points_vec[pt_index] ||
all_curves_vec[cv_index].target() == all_points_vec[pt_index])
{
cout << "Was NOT successful" << endl;
cout << "Precondition fault: Split point is an end point of the curve"
<< endl;
return (false);
}
// Split the curve.
X_curve cv1, cv2;
tr.curve_split (all_curves_vec[cv_index],
cv1, cv2,
all_points_vec[pt_index]);
// Check the results.
if (cv1.source() != all_curves_vec[cv_index].source())
{
cout << "Was NOT successful" << endl;
cout << "Source points of first parts are different" << endl;
return (false);
}
if (cv1.target() != all_points_vec[pt_index])
{
cout << "Was NOT successful" << endl;
cout << "Target points of first parts are different" << endl;
return (false);
}
if (cv2.source() != all_points_vec[pt_index])
{
cout << "Was NOT successful" << endl;
cout << "Source points of second parts are different" << endl;
return (false);
}
if( cv2.target() != all_curves_vec[cv_index].target())
{
cout << "Was NOT successful" << endl;
cout << "Target points of second are different" << endl;
return (false);
}
cout << "Was successfull" << endl;
return (true);
}
#endif