TheBoussinesqModel  3.2.1
 All Data Structures Files Functions Variables Typedefs Macros Pages
geometry_utilities.c File Reference
#include "turtle.h"
#include "geometry.h"

Go to the source code of this file.

Functions

int signum (long a)
 
int signum_double (double a)
 
int segment_intersection_occurence (LINE *L1, LINE *L2)
 
long query_freq_longvector (LONGVECTOR *lvector, long value)
 
int check_vertex_intersection_2_lines (long b1, long e1, long b2, long e2)
 
int check_3_numbers (long a, long b, long c)
 
double area2d (POINT *P1, POINT *P2, POINT *P3)
 
double distance2D (POINT *P1, POINT *P2)
 
long shared_edges (POLYGON *PO1, POLYGON *PO2, long no_intersection, long *l_po1, long *l_po2, double *dist_centroids)
 

Function Documentation

double area2d ( POINT P1,
POINT P2,
POINT P3 
)
Returns
calculetes the area of the triangle among three points;
Author
Emanuele Cordano
Date
October 2008

area's formulas on http://it.wikipedia.org/wiki/Triangolo

Definition at line 154 of file geometry_utilities.c.

References POINT::x, and POINT::y.

Referenced by new_polygon_from_a_linevector().

int check_3_numbers ( long  a,
long  b,
long  c 
)
Parameters
(long)a,b,c - three long integer values
Author
Emanuele Cordano
Date
October 2008
Returns
1 if a=b=c , 0 otherwise

Definition at line 139 of file geometry_utilities.c.

References FALSE, and TRUE.

int check_vertex_intersection_2_lines ( long  b1,
long  e1,
long  b2,
long  e2 
)
Parameters
(long)b1 - begin point index of line 1
(long)e1 - end point index of line 1
(long)b2 - begin point index of line 2
(long)e2 - end point index of line 2
Returns
0 if the lines are not connected, 1 if they share only 1 edge, 2 if they share both the edges
Author
Emanuele Cordano October 2008

the two lines coincide

the lines share a vertex

the lines has no intersection at the edges

Definition at line 113 of file geometry_utilities.c.

References signum().

double distance2D ( POINT P1,
POINT P2 
)
Returns
euclidean 2d distance between points P1 and P2
Author
Emanuele Cordano
Date
October 2008

Definition at line 177 of file geometry_utilities.c.

References POINT::x, and POINT::y.

Referenced by new_line_from_points(), and shared_edges().

long query_freq_longvector ( LONGVECTOR lvector,
long  value 
)
Author
Emanuele Cordano \date October 2008

Definition at line 98 of file geometry_utilities.c.

References LONGVECTOR::nl.

Referenced by new_polygon_from_a_linevector().

int segment_intersection_occurence ( LINE L1,
LINE L2 
)
Author
Emanuele Cordano
Date
October 2008
Returns
0 if the lines are not connected, 1 if they share only 1 point, 2 if they share more than 1 point

Apply Cramer's Rule (http://en.wikipedia.org/wiki/Cramer%27s_rule)

Definition at line 61 of file geometry_utilities.c.

References LINE::begin, LINE::end, POINT::x, and POINT::y.

Referenced by new_polygon_from_a_linevector().

long shared_edges ( POLYGON PO1,
POLYGON PO2,
long  no_intersection,
long *  l_po1,
long *  l_po2,
double *  dist_centroids 
)
Author
Emanuele Cordano
Date
November 2008
Parameters
PO1- (POLYGON *) the first polygon
PO2- (POLYGON *) the second polygon
no_intersection- (long) integer vale which is returend in case PO1 and PO2 do not share any edge.
l_po1- (double) number of the shared edge respect to the polygon PO1
l_po2- (double) number of the shared edge respect to the polygon PO2
dist_centroids- (double) distance between the two centroids of the polygons
Returns
the index of the edge shared between the two polygons;

Definition at line 186 of file geometry_utilities.c.

References POLYGON::centroid, distance2D(), POLYGON::edge_indices, POLYGON::index, and LONGVECTOR::nl.

Referenced by get_connection(), and get_connection_squares().

int signum ( long  a)
BGEOMETRY BUILDS THE MESH FROM A RASTER FOR THE BOUSSINESQ MODEL

KeyPalette Version 0.9375 KMackenzie

file geometry_utilities.c

Copyright, 2009 Emanuele Cordano and Riccardo Rigon

This file is part of BGEOMETRY. BGEOMETRY is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

BGEOMETRY is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Emanuele Cordano
Date
October 2008

Definition at line 27 of file geometry_utilities.c.

Referenced by check_vertex_intersection_2_lines().

int signum_double ( double  a)
Author
Emanuele Cordano
Date
October 2008

Definition at line 44 of file geometry_utilities.c.