Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

ray_intersect.c File Reference

#include <volume_io/internal_volume_io.h>
#include <bicpl/geom.h>
#include <bicpl/numerical.h>

Include dependency graph for ray_intersect.c:

Include dependency graph

Go to the source code of this file.

Defines

#define MAX_POINTS   30
#define TOLERANCE   1.0e-2
#define TRIANGLE_TOLERANCE   1.0e-3

Functions

private BOOLEAN point_within_triangle_2d (Point *pt, Point points[])
private BOOLEAN point_within_polygon_2d (Point *pt, int n_points, Point points[], Vector *polygon_normal)
public void initialize_intersect_directions (void)
public Real * get_intersect_directions (void)
private BOOLEAN intersect_ray_triangle (Point *ray_origin, Vector *ray_direction, Point *point0, Point *point1, Point *point2, Real *dist)
private BOOLEAN intersect_ray_polygon_points (Point *ray_origin, Vector *ray_direction, int n_points, Point points[], Real *dist)
private BOOLEAN intersect_ray_polygon (Point *ray_origin, Vector *ray_direction, Real *dist, polygons_struct *polygons, int poly_index)
public BOOLEAN point_within_polygon (Point *pt, int n_points, Point points[], Vector *polygon_normal)
private BOOLEAN intersect_ray_quadmesh_patch (Point *ray_origin, Vector *ray_direction, Real *dist, quadmesh_struct *quadmesh, int obj_index)
public BOOLEAN line_intersects_ellipsoid (Point *line_origin, Vector *line_direction, Point *sphere_centre, Real x_size, Real y_size, Real z_size, Real *t_min, Real *t_max)
public BOOLEAN ray_intersects_sphere (Point *origin, Vector *direction, Point *centre, Real radius, Real *dist)
private BOOLEAN ray_intersects_tube (Point *origin, Vector *direction, Point *p1, Point *p2, Real radius, Real *dist)
private BOOLEAN intersect_ray_tube_segment (Point *origin, Vector *direction, Real *dist, lines_struct *lines, int obj_index)
private BOOLEAN intersect_ray_with_cube (Point *ray_origin, Vector *ray_direction, Point *centre, Real size, Real *dist)
private BOOLEAN intersect_ray_with_marker (Point *ray_origin, Vector *ray_direction, marker_struct *marker, Real *dist)
public void intersect_ray_object (Point *origin, Vector *direction, object_struct *object, int obj_index, int *closest_obj_index, Real *closest_dist, int *n_intersections, Real *distances[])
public int intersect_ray_with_object (Point *origin, Vector *direction, object_struct *object, int *obj_index, Real *dist, Real *distances[])

Variables

private int n_dirs = -1
private Real * dirs = NULL


Define Documentation

#define MAX_POINTS   30
 

Definition at line 19 of file ray_intersect.c.

#define TOLERANCE   1.0e-2
 

Definition at line 25 of file ray_intersect.c.

Referenced by find_boundary_in_direction(), and point_within_polygon_2d().

#define TRIANGLE_TOLERANCE   1.0e-3
 

Definition at line 26 of file ray_intersect.c.

Referenced by point_within_triangle_2d().


Function Documentation

public Real* get_intersect_directions void   ) 
 

Definition at line 49 of file ray_intersect.c.

References dirs, and n_dirs.

public void initialize_intersect_directions void   ) 
 

Definition at line 40 of file ray_intersect.c.

References dirs, and n_dirs.

public void intersect_ray_object Point *  origin,
Vector *  direction,
object_struct object,
int  obj_index,
int *  closest_obj_index,
Real *  closest_dist,
int *  n_intersections,
Real *  distances[]
 

Definition at line 917 of file ray_intersect.c.

References get_lines_ptr(), get_marker_ptr(), get_object_type(), get_polygons_ptr(), get_quadmesh_ptr(), intersect_ray_polygon(), intersect_ray_quadmesh_patch(), intersect_ray_tube_segment(), intersect_ray_with_marker(), LINES, MARKER, POLYGONS, and QUADMESH.

Referenced by intersect_ray_with_object(), and recursive_intersect_ray().

private BOOLEAN intersect_ray_polygon Point *  ray_origin,
Vector *  ray_direction,
Real *  dist,
polygons_struct polygons,
int  poly_index
 

Definition at line 212 of file ray_intersect.c.

References polygons_struct::end_indices, FALSE, polygons_struct::indices, intersect_ray_polygon_points(), intersect_ray_triangle(), MAX_POINTS, polygons_struct::points, START_INDEX, and polygons_struct::visibilities.

Referenced by intersect_ray_object().

private BOOLEAN intersect_ray_polygon_points Point *  ray_origin,
Vector *  ray_direction,
int  n_points,
Point  points[],
Real *  dist
 

Definition at line 172 of file ray_intersect.c.

References FALSE, and intersect_ray_triangle().

Referenced by intersect_ray_polygon(), and intersect_ray_quadmesh_patch().

private BOOLEAN intersect_ray_quadmesh_patch Point *  ray_origin,
Vector *  ray_direction,
Real *  dist,
quadmesh_struct quadmesh,
int  obj_index
 

Definition at line 521 of file ray_intersect.c.

References get_quadmesh_n_objects(), get_quadmesh_patch(), and intersect_ray_polygon_points().

Referenced by intersect_ray_object().

private BOOLEAN intersect_ray_triangle Point *  ray_origin,
Vector *  ray_direction,
Point *  point0,
Point *  point1,
Point *  point2,
Real *  dist
 

Definition at line 68 of file ray_intersect.c.

References dirs, FALSE, n_dirs, nx, ny, and nz.

Referenced by intersect_ray_polygon(), and intersect_ray_polygon_points().

private BOOLEAN intersect_ray_tube_segment Point *  origin,
Vector *  direction,
Real *  dist,
lines_struct lines,
int  obj_index
 

Definition at line 776 of file ray_intersect.c.

References lines_struct::end_indices, get_line_segment_index(), lines_struct::indices, lines_struct::line_thickness, POINT_INDEX, lines_struct::points, ray_intersects_sphere(), ray_intersects_tube(), and TRUE.

Referenced by intersect_ray_object().

private BOOLEAN intersect_ray_with_cube Point *  ray_origin,
Vector *  ray_direction,
Point *  centre,
Real  size,
Real *  dist
 

Definition at line 832 of file ray_intersect.c.

References clip_line_to_box(), and FALSE.

Referenced by intersect_ray_with_marker().

private BOOLEAN intersect_ray_with_marker Point *  ray_origin,
Vector *  ray_direction,
marker_struct marker,
Real *  dist
 

Definition at line 880 of file ray_intersect.c.

References BOX_MARKER, intersect_ray_with_cube(), marker_struct::position, ray_intersects_sphere(), marker_struct::size, and marker_struct::type.

Referenced by intersect_ray_object().

public int intersect_ray_with_object Point *  origin,
Vector *  direction,
object_struct object,
int *  obj_index,
Real *  dist,
Real *  distances[]
 

Definition at line 988 of file ray_intersect.c.

References lines_struct::bintree, polygons_struct::bintree, quadmesh_struct::bintree, lines_struct::end_indices, get_lines_ptr(), get_object_type(), get_polygons_ptr(), get_quadmesh_n_objects(), get_quadmesh_ptr(), intersect_ray_object(), intersect_ray_with_bintree(), LINES, MARKER, lines_struct::n_items, polygons_struct::n_items, POLYGONS, and QUADMESH.

public BOOLEAN line_intersects_ellipsoid Point *  line_origin,
Vector *  line_direction,
Point *  sphere_centre,
Real  x_size,
Real  y_size,
Real  z_size,
Real *  t_min,
Real *  t_max
 

Definition at line 565 of file ray_intersect.c.

References FALSE, solve_quadratic(), and TRUE.

Referenced by ray_intersects_sphere().

public BOOLEAN point_within_polygon Point *  pt,
int  n_points,
Point  points[],
Vector *  polygon_normal
 

Definition at line 280 of file ray_intersect.c.

References point_within_polygon_2d(), and point_within_triangle_2d().

Referenced by find_point_polygon_distance_sq().

private BOOLEAN point_within_polygon_2d Point *  pt,
int  n_points,
Point  points[],
Vector *  polygon_normal
 

Definition at line 366 of file ray_intersect.c.

References FALSE, nx, ny, nz, TOLERANCE, TRUE, and y.

Referenced by point_within_polygon().

private BOOLEAN point_within_triangle_2d Point *  pt,
Point  points[]
 

Definition at line 312 of file ray_intersect.c.

References FALSE, and TRIANGLE_TOLERANCE.

Referenced by point_within_polygon().

public BOOLEAN ray_intersects_sphere Point *  origin,
Vector *  direction,
Point *  centre,
Real  radius,
Real *  dist
 

Definition at line 630 of file ray_intersect.c.

References FALSE, and line_intersects_ellipsoid().

Referenced by intersect_ray_tube_segment(), and intersect_ray_with_marker().

private BOOLEAN ray_intersects_tube Point *  origin,
Vector *  direction,
Point *  p1,
Point *  p2,
Real  radius,
Real *  dist
 

Definition at line 675 of file ray_intersect.c.

References clip_line_to_box(), FALSE, solve_quadratic(), and y.

Referenced by intersect_ray_tube_segment().


Variable Documentation

private Real* dirs = NULL
 

Definition at line 38 of file ray_intersect.c.

Referenced by get_intersect_directions(), initialize_intersect_directions(), and intersect_ray_triangle().

private int n_dirs = -1
 

Definition at line 37 of file ray_intersect.c.

Referenced by dilate_voxels_3d(), fill_connected_voxels(), get_3D_neighbour_directions(), get_intersect_directions(), get_neighbour_directions(), initialize_intersect_directions(), and intersect_ray_triangle().


Generated on Wed Jul 28 09:11:16 2004 for BICPL by doxygen 1.3.7