Skip to content
Snippets Groups Projects
Commit 377290f0 authored by Brandon Lai-Cheong's avatar Brandon Lai-Cheong
Browse files

refactor into include folder

parent af282f4d
No related branches found
No related tags found
No related merge requests found
Showing
with 125 additions and 33 deletions
{
"files.associations": {
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
}
}
\ No newline at end of file
......@@ -22,18 +22,19 @@ add_executable(
tests
tests/unit_tests/simple_triangle_tests.cpp
tests/unit_tests/contourize_tests.cpp
src/intersections/intersections.cpp
tests/unit_tests/point_in_triangle_tests.cpp
src/utilities/intersections.cpp
src/shapes/triangle.cpp
src/shapes/triangle_edges.cpp
src/contourize/contourize.cpp
src/utilities/contourize.cpp
src/shapes/edge.cpp
src/orientation/orientation.cpp
src/utilities/orientation.cpp
src/shapes/point.cpp
src/union.cpp
src/triangulation/triangulation.cpp
src/utilities/triangulation.cpp
)
include_directories(src)
include_directories(include)
target_link_libraries(
tests
......
File moved
File moved
#pragma once
#include <vector>
#include "../shapes/point.h"
#include "../shapes/triangle.h"
#include <triangle.h>
struct TrigTrigInterResults {
std::vector<Point> results;
......
File moved
File moved
File moved
#pragma once
#include "point.h"
// points specified clockwise
// points specified counterclockwise
struct Triangle {
Point points[3];
int depth;
......
File moved
......@@ -4,4 +4,6 @@
struct Triangle;
struct Point;
std::vector<Triangle> monotoneTriangulate(std::vector<Point> &points);
\ No newline at end of file
std::vector<Triangle> triangulate(std::vector<Point> points);
#pragma once
#include <vector>
struct Triangle;
std::vector<Triangle> unionize(const Triangle &t1, const Triangle &t2);
\ No newline at end of file
......@@ -12,7 +12,7 @@ bool Triangle::pointInTriangle(const Point &p) const {
// all tests must be positive
auto edges = TriangleEdges(*this);
return edges.e1.positiveSide(p) &&
edges.e2.positiveSide(p) &&
edges.e3.positiveSide(p);
return !edges.e1.positiveSide(p) &&
!edges.e2.positiveSide(p) &&
!edges.e3.positiveSide(p);
}
\ No newline at end of file
#include "triangulation.h"
std::vector<Triangle> monotoneTriangulate(std::vector<Point> &points) {
}
\ No newline at end of file
#include "shapes/triangle.h"
#include <vector>
#include <optional>
#include <intersections/intersections.h>
#include <contourize/contourize.h>
#include <triangulation/triangulation.h>
#include <union.h>
#include <contourize.h>
#include <intersections.h>
#include <triangulation.h>
std::vector<Triangle> unionize(const Triangle &t1, const Triangle &t2) {
......@@ -23,7 +22,7 @@ std::vector<Triangle> unionize(const Triangle &t1, const Triangle &t2) {
std::vector<Point> contour = contourize(t1, t2, newIntersections);
return monotoneTriangulate(contour);
return triangulate(contour);
}
void unionize(Triangle soup) {
......
#include <shapes/triangle.h>
#include <vector>
#include "contourize.h"
#include <orientation/orientation.h>
#include <triangle.h>
#include <orientation.h>
Triangle clockwiseToCounterclockwise(const Triangle &t) {
return Triangle(t.points[0], t.points[2], t.points[1], t.depth);
......
#include "intersections.h"
#include <shapes/edge.h>
#include <shapes/triangle_edges.h>
#include <shapes/point.h>
#include <optional>
#include <edge.h>
#include <triangle_edges.h>
......
#include "orientation.h"
#include <shapes/point.h>
#include <point.h>
Orientation orientation(const Point &p1, const Point &p2, const Point &p3) {
int val = (p2.y - p1.y) * (p3.x - p2.x) - (p2.x - p1.x) * (p3.y - p2.y);
......
#include "triangulation.h"
#include <list>
#include <point.h>
#include <triangle.h>
/*
bool isAnEar(Point point, Triangle triangle, Point start[], Point end[]) {
}
*/
std::vector<Triangle> triangulate(std::vector<Point> points) {
//std::list<Point> polygon = std::list(points);
std::vector<Triangle> result;
for (int i = 0; i < points.size(); i++) {
}
return result;
}
\ No newline at end of file
#include "gtest/gtest.h"
#include <contourize/contourize.h>
#include <intersections/intersections.h>
#include <gtest/gtest.h>
#include <contourize.h>
#include <triangle.h>
#include <intersections.h>
TEST(ContourizeTest, TwoTriangles) {
auto t1 = Triangle(Point(0,0), Point(5,0), Point(2,3), 0);
auto t2 = Triangle(Point(3,1), Point(6,1), Point(4,3), 0);
auto t1 = Triangle(Point{0,0}, Point{5,0}, Point{2,3}, 0);
auto t2 = Triangle(Point{3,1}, Point{6,1}, Point{4,3}, 0);
auto newIntersections = intersections(t1, t2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment