My Project
Functions
helperfunctions.h File Reference
#include "basicComponents.h"
#include "complexComponents.h"
#include <vector>
#include <set>
Include dependency graph for helperfunctions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

Vertice transform (Vertice v_in, double Xrot, double Yrot, double Zrot, double Xoff, double Yoff, double Zoff)
 Transforms a vertice (rotation and offset) using matrix multiplication and returns a new Vertice object. More...
 
pair< int, Verticeget_intersection (Edge a, Edge b)
 Finds intersection of two edges (line segments) and also returns error if intersection does not exist. More...
 
bool is_inside (Vertice v, set< Edge > edgeSet)
 Checks whether a vertice is inside (in 2d) of a face formed by an edge loop. More...
 
bool isSubset (vector< int > &a, vector< int > &b)
 
int verticePresent (vector< Vertice > &a, Vertice b)
 Checks if a vertice is present in a vector of vertices. More...
 
WireFrame modifyWireframe (WireFrame wf, Vertice v)
 Takes a wireframe and subtracts coordinates of v from all its edge vertices. More...
 

Function Documentation

◆ get_intersection()

pair<int,Vertice> get_intersection ( Edge  a,
Edge  b 
)

Finds intersection of two edges (line segments) and also returns error if intersection does not exist.

returns (1,point of intersection) if intersecting, (0,_) if overlapping and (-1,_) if parallel Both edges are 2D edges

◆ is_inside()

bool is_inside ( Vertice  v,
set< Edge edgeSet 
)

Checks whether a vertice is inside (in 2d) of a face formed by an edge loop.

Checks if vertex is inside the polygon defined by the edge set

◆ isSubset()

bool isSubset ( vector< int > &  a,
vector< int > &  b 
)

A simple helper function to check if a is a subset of b

◆ modifyWireframe()

WireFrame modifyWireframe ( WireFrame  wf,
Vertice  v 
)

Takes a wireframe and subtracts coordinates of v from all its edge vertices.

◆ transform()

Vertice transform ( Vertice  v_in,
double  Xrot,
double  Yrot,
double  Zrot,
double  Xoff,
double  Yoff,
double  Zoff 
)

Transforms a vertice (rotation and offset) using matrix multiplication and returns a new Vertice object.

get transformed 3D object

◆ verticePresent()

int verticePresent ( vector< Vertice > &  a,
Vertice  b 
)

Checks if a vertice is present in a vector of vertices.

A simple helper function which checks if vertex is already present in vector (allowing for some error correction)