Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

computational_geometry.h File Reference

#include <cmath>
#include <vector>
#include <string>
#include "AO_cpp.h"
#include "three_frame.h"

Go to the source code of this file.

Namespaces

namespace  Arroyo

Functions

std::vector< Arroyo::three_pointget_line_segment_intersection (const three_point &a1, const three_point &a2, const three_point &b1, const three_point &b2)
Arroyo::three_point get_ray_ray_intersection (const Arroyo::three_point &o_a, const Arroyo::three_vector &n_a, const Arroyo::three_point &o_b, const Arroyo::three_vector &n_b)
Arroyo::three_point get_ray_plane_intersection (const Arroyo::three_point &o_a, const Arroyo::three_vector &n_a, const Arroyo::three_point &o_b, const Arroyo::three_vector &n_b)
double get_area_of_polygon (const std::vector< Arroyo::three_point > &polygon_vertices)
bool point_within_polygon (const three_point &tp, const vector< three_point > &vertices, bool &point_on_edge, bool &point_on_vertex)
bool point_within_polygon (const three_point &tp, const vector< three_point > &vtp)
vector< three_point > get_convex_polygon_intersection (const vector< three_point > &first_polygon_vertices, const vector< three_point > &second_polygon_vertices, int verbose=0)
vector< three_point > get_line_segment_circle_intersection (const three_point &a1, const three_point &a2, const three_point &circle_origin, const double &radius, vector< bool > &intersection_point_on_boundary, int verbose=0)
vector< three_point > get_convex_polygon_circle_intersection (const vector< three_point > &polygon_vertices, const three_frame &circle_tf, double radius)
template<class T>
void convex_polygon_integration (const three_frame &tf, const vector< three_point > &polygon_vertices, T &x_intgrl, T &y_intgrl, int verbose=0)


Function Documentation

template<class T>
void convex_polygon_integration const three_frame &  tf,
const vector< three_point > &  polygon_vertices,
T &  x_intgrl,
T &  y_intgrl,
int  verbose = 0
 

This function analytically integrates x and y over a region of support defined by the convex polygon. The three frame tf is used to define x and y, and the origin of this frame defines the zero point. All vertices of the polygon must lie in the x-y plane of this three frame. The results of the integration are returned in x_intgrl and y_intgrl, respectively.

This function is used to compute elements of the geometry matrix for pyramidal actuator influence functions

double get_area_of_polygon const std::vector< Arroyo::three_point > &  polygon_vertices  ) 
 

vector<three_point> get_convex_polygon_circle_intersection const vector< three_point > &  polygon_vertices,
const three_frame &  circle_tf,
double  radius
 

Find the overlap between a convex polygon with vertices polygon_vertices and a circular region with the given radius. The origin of the reference frame is taken to be the center of the circle, which is assumed to be in the x-y plane of this reference frame. The polygon vertices must lie in this plane or this function throws an error. If the number of vertices in the polygon is less than three, an error is thrown.

This function is meant to apply to the case when the polygon is much smaller than the circle, so that we can assume that polygons which overlap the circular border are divided by a chord of the circle rather than an arc. The function returns the vertices of the resulting convex polygon.

vector<three_point> get_convex_polygon_intersection const vector< three_point > &  first_polygon_vertices,
const vector< three_point > &  second_polygon_vertices,
int  verbose = 0
 

Partially based on "Computational Geometry in C" by O'Rourke Section 7.4.

This function returns the vertices of a convex polygon formed from the intersection of two convex polygons, each specified by their vertices. The first_polygon_vertices and second_polygon_vertices must each contain at least three unique three_points, no three of which may be collinear. The vertices of each polygon must be ordered in the same sense of rotation. If either of these conditions are violated, this function throws an error.

WARNING: this function can return inaccurate results due to numerical roundoff. Quantifying the limits of validity of this function is a work in progress.

vector<three_point> get_line_segment_circle_intersection const three_point &  a1,
const three_point &  a2,
const three_point &  circle_origin,
const double &  radius,
vector< bool > &  intersection_point_on_boundary,
int  verbose = 0
 

std::vector<Arroyo::three_point> get_line_segment_intersection const three_point &  a1,
const three_point &  a2,
const three_point &  b1,
const three_point &  b2
 

Arroyo::three_point get_ray_plane_intersection const Arroyo::three_point o_a,
const Arroyo::three_vector n_a,
const Arroyo::three_point o_b,
const Arroyo::three_vector n_b
 

Return the point of intersection between a ray extending from o_a in the direction n_a and a plane defined by normal n_b and origin o_b.

Arroyo::three_point get_ray_ray_intersection const Arroyo::three_point o_a,
const Arroyo::three_vector n_a,
const Arroyo::three_point o_b,
const Arroyo::three_vector n_b
 

Return the point of intersection between a ray extending from o_a in the direction n_a, and a ray extending from o_b in the direction n_b.

bool point_within_polygon const three_point &  tp,
const vector< three_point > &  vtp
 

Same as above, but no degeneracy information

bool point_within_polygon const three_point &  tp,
const vector< three_point > &  vertices,
bool &  point_on_edge,
bool &  point_on_vertex
 

Modified from "Ray Tracing News Volume 5, Number 3. Some explanation also appears on page 117 of "Object oriented ray tracing in C++" by Nicholas Wilt

Shoot a test ray along +X axis and count the crossings Note: the points in vtp are interpreted as ordered vertices of the polygon. They may be ordered clockwise or counterclockwise

If the point lies at a distance less than three_frame::precision from a vertex or a segment edge of the polygon, it is defined as lying within the polygon. These two cases are indicated by the value of the booleans passed to the function

WARNING: this function can return inaccurate results due to numerical roundoff. Quantifying the limits of validity of this function is a work in progress.


Generated on Thu Nov 29 17:16:32 2007 for arroyo by  doxygen 1.3.9.1