OOFEM 3.0
Loading...
Searching...
No Matches
oofem::Graph Class Reference

#include <geotoolbox.h>

Collaboration diagram for oofem::Graph:

Classes

struct  node

Public Member Functions

 Graph ()
 ~Graph ()
void clip (Polygon &result, const Polygon &a, const Polygon &b)

Protected Types

enum  nodeStatus { NS_Vertex , NS_IntersectionVertex , NS_Intersection }

Protected Member Functions

void insert (node *ins, node *first, node *last)
nodecreateNode (double x, double y, node *next, node *prev, node *nextPoly, node *neighbor, nodeStatus st, int entry, int visited, double alpha)
nodenext_node (node *p)
nodeprev_node (node *p)
nodelast_node (node *p)
nodefirst (node *p)
void remove (node *n)
double dist (double x1, double y1, double x2, double y2)
int testIfIntersect (node *p1, node *p2, node *q1, node *q2, double *alpha_p, double *alpha_q, double *xint, double *yint)
int testIfCoincident (node *p1, node *p2, node *q1, node *q2, double *alpha_1, double *alpha_2)
int testPoint (node *poly, double x, double y) const
bool belongs (node *n, node *v1, node *v2)
bool intersectionExist (node *p1, node *p2, node *q1, node *q2)
void removeIntersectionIfExist (node *p1, node *p2, node *q1, node *q2)
int vertex2IntersectionVertex (node *v, node *l1, node *l2)
void testNewIntersectionVertexEdgeCollapse (node *v, node *l1, node *l2)
bool testCollapsedEdge (node *p1, node *p2)
void merge2vertex (node *v1, node *v2)
void printYourself ()
void clear ()

Protected Attributes

nodes
nodec

Detailed Description

Class representing the special graph constructed from two polygons that is used to perform boolean operation on polygons (polygon clipping in current implementation). In short, the graph contains polygon vertices and intersections of polygon edges. Then graph edges represent the edges between graph nodes (graph edge correspond to polygon edge if this edge has no intersection with other edges of second polygon, or single polygon edge can be represented by two or more graph edges if intersections are present). Each polygon vertex representing intersection contain link to its twin representing the same intersection on second polygon. This allows to perform traversal walk over graph edges and vertices that can represent various boolean operations. This class is a part of geometry toolbox.

Definition at line 191 of file geotoolbox.h.

Member Enumeration Documentation

◆ nodeStatus

enum oofem::Graph::nodeStatus
protected
Enumerator
NS_Vertex 
NS_IntersectionVertex 
NS_Intersection 

Definition at line 194 of file geotoolbox.h.

Constructor & Destructor Documentation

◆ Graph()

oofem::Graph::Graph ( )
inline

Definition at line 211 of file geotoolbox.h.

References c, and s.

◆ ~Graph()

oofem::Graph::~Graph ( )

Definition at line 224 of file geotoolbox.C.

References clear().

Member Function Documentation

◆ belongs()

bool oofem::Graph::belongs ( node * n,
node * v1,
node * v2 )
protected

◆ clear()

void oofem::Graph::clear ( )
protected

Definition at line 231 of file geotoolbox.C.

References c, oofem::Graph::node::next, and s.

Referenced by ~Graph().

◆ clip()

◆ createNode()

Graph::node * oofem::Graph::createNode ( double x,
double y,
node * next,
node * prev,
node * nextPoly,
node * neighbor,
nodeStatus st,
int entry,
int visited,
double alpha )
protected

◆ dist()

double oofem::Graph::dist ( double x1,
double y1,
double x2,
double y2 )
protected

Definition at line 1438 of file geotoolbox.C.

Referenced by testCollapsedEdge(), testIfCoincident(), and testIfIntersect().

◆ first()

◆ insert()

void oofem::Graph::insert ( node * ins,
node * first,
node * last )
protected

Definition at line 1470 of file geotoolbox.C.

References oofem::Graph::node::alpha, first(), oofem::Graph::node::next, and oofem::Graph::node::prev.

Referenced by clip().

◆ intersectionExist()

bool oofem::Graph::intersectionExist ( node * p1,
node * p2,
node * q1,
node * q2 )
protected

◆ last_node()

Graph::node * oofem::Graph::last_node ( node * p)
protected

Definition at line 1378 of file geotoolbox.C.

References oofem::Graph::node::next.

◆ merge2vertex()

void oofem::Graph::merge2vertex ( node * v1,
node * v2 )
protected

◆ next_node()

◆ prev_node()

◆ printYourself()

void oofem::Graph::printYourself ( )
protected

◆ remove()

void oofem::Graph::remove ( node * n)
protected

◆ removeIntersectionIfExist()

void oofem::Graph::removeIntersectionIfExist ( node * p1,
node * p2,
node * q1,
node * q2 )
protected

◆ testCollapsedEdge()

bool oofem::Graph::testCollapsedEdge ( node * p1,
node * p2 )
protected

Definition at line 1514 of file geotoolbox.C.

References dist(), GT_EPS, oofem::Graph::node::x, and oofem::Graph::node::y.

Referenced by clip().

◆ testIfCoincident()

int oofem::Graph::testIfCoincident ( node * p1,
node * p2,
node * q1,
node * q2,
double * alpha_1,
double * alpha_2 )
protected

Definition at line 255 of file geotoolbox.C.

References dist(), GT_EPS, GT_TEPS, oofem::min(), oofem::sgn(), oofem::Graph::node::x, and oofem::Graph::node::y.

Referenced by clip().

◆ testIfIntersect()

int oofem::Graph::testIfIntersect ( node * p1,
node * p2,
node * q1,
node * q2,
double * alpha_p,
double * alpha_q,
double * xint,
double * yint )
protected

Definition at line 463 of file geotoolbox.C.

References dist(), GT_EPS, GT_TEPS, oofem::Graph::node::x, and oofem::Graph::node::y.

Referenced by clip().

◆ testNewIntersectionVertexEdgeCollapse()

void oofem::Graph::testNewIntersectionVertexEdgeCollapse ( node * v,
node * l1,
node * l2 )
protected

◆ testPoint()

int oofem::Graph::testPoint ( node * poly,
double x,
double y ) const
protected

Definition at line 1718 of file geotoolbox.C.

References oofem::Graph::node::next, s, oofem::Graph::node::x, and oofem::Graph::node::y.

Referenced by clip().

◆ vertex2IntersectionVertex()

int oofem::Graph::vertex2IntersectionVertex ( node * v,
node * l1,
node * l2 )
protected

Member Data Documentation

◆ c

node * oofem::Graph::c
protected

Definition at line 209 of file geotoolbox.h.

Referenced by clear(), clip(), Graph(), and printYourself().

◆ s

node* oofem::Graph::s
protected

Definition at line 209 of file geotoolbox.h.

Referenced by clear(), clip(), Graph(), printYourself(), and testPoint().


The documentation for this class was generated from the following files:

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011