00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
#include <volume_io/internal_volume_io.h>
00016
#include <bicpl/geom.h>
00017
00018
#ifndef lint
00019
static char rcsid[] =
"$Header: /software/source//libraries/bicpl/Geometry/line_circle.c,v 1.11 2000/02/06 15:30:15 stever Exp $";
00020
#endif
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 public void create_line_circle(
00041 Point *centre,
00042
int plane_axis,
00043 Real x_radius,
00044 Real y_radius,
00045
int n_points,
00046
lines_struct *lines )
00047 {
00048
int i, a1, a2;
00049 Real angle;
00050
00051
initialize_lines( lines,
WHITE );
00052
00053 lines->
n_points = n_points;
00054 lines->
n_items = 1;
00055
00056 ALLOC( lines->
points, n_points );
00057 ALLOC( lines->
end_indices, 1 );
00058 ALLOC( lines->
indices, n_points+1 );
00059
00060 a1 = (plane_axis+1) % 3;
00061 a2 = (plane_axis+2) % 3;
00062
00063 for_less( i, 0, n_points )
00064 {
00065 angle = 2.0 * PI * (Real) i / (Real) n_points;
00066 Point_coord(lines->
points[i],a1) = (Point_coord_type)
00067 ( (Real) Point_coord(*centre,a1) + x_radius * cos( angle ) );
00068 Point_coord(lines->
points[i],a2) = (Point_coord_type)
00069 ( (Real) Point_coord(*centre,a2) + y_radius * sin( angle ) );
00070 Point_coord(lines->
points[i],plane_axis) =
00071 Point_coord(*centre,plane_axis);
00072 }
00073
00074 for_less( i, 0, n_points )
00075 lines->
indices[i] = i;
00076
00077 lines->
indices[n_points] = 0;
00078
00079 lines->
end_indices[0] = n_points+1;
00080 }