-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Project exclude paths | ||
# Project exclude paths | ||
/cmake-build-debug/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,65 @@ | ||
// | ||
// Created by Ryan.Zurrin001 on 12/16/2021. | ||
// | ||
#include <cmath> | ||
|
||
#include "Angle.h" | ||
|
||
//float rez::AngleLines2D( const Line2d& l1, const Line2d l2) | ||
//{ | ||
// auto mag_l1 = l1.direction().magnitude(); | ||
// auto mag_l2 = l2.direction().magnitude(); | ||
// auto dot = dotProduct(l1.direction(), l2.direction()); | ||
// | ||
// auto theta = acos( fabs(dot) / (mag_l1 * mag_l2)); | ||
// return RadianceToDegrees(theta); | ||
//} | ||
|
||
//float rez::AngleLines3D(const Line& l1, const Line& l2) | ||
//{ | ||
// auto mag_l1 = l1.direction().magnitude(); | ||
// auto mag_l2 = l2.direction().magnitude(); | ||
// auto dot = dotProduct(l1.direction(), l2.direction()); | ||
// | ||
// auto theta = acos(fabs(dot) / (mag_l1 * mag_l2)); | ||
// return RadianceToDegrees(theta); | ||
//} | ||
|
||
//float rez::AngleLinePlane(const Line& l, const Planef p) | ||
//{ | ||
// auto dot = dotProduct(l.direction(), p.getNormal()); | ||
// auto theta = acos(fabs(dot)); | ||
// theta = RadianceToDegrees(theta); | ||
// return 90- theta; | ||
//} | ||
|
||
using namespace rez; | ||
|
||
template<class T, size_t dimensions > | ||
static float getAngle(rez::Vector<T, dimensions> v1, rez::Vector<T, dimensions> v2) | ||
{ | ||
auto dot = dotProduct(v1, v2); | ||
auto theta = acos(fabs(dot)); | ||
return RadianceToDegrees(theta); | ||
} | ||
|
||
float rez::AngleLines2D(const Line2d& l1, const Line2d l2) | ||
{ | ||
return getAngle(l1.direction(), l2.direction()); | ||
} | ||
|
||
float rez::AngleLines3D(const Line& l1, const Line& l2) | ||
{ | ||
return getAngle(l1.direction(), l2.direction()); | ||
} | ||
|
||
float rez::AngleLinePlane(const Line& l, const Planef p) | ||
{ | ||
auto theta = getAngle(l.direction(), p.getNormal()); | ||
return 90 - theta; | ||
} | ||
|
||
float rez::AnglePlanes(const Planef p1, const Planef p2) | ||
{ | ||
return getAngle(p1.getNormal(), p2.getNormal()); | ||
} | ||
// | ||
// Created by Ryan.Zurrin001 on 12/16/2021. | ||
// | ||
#include <cmath> | ||
|
||
#include "Angle.h" | ||
|
||
//float rez::AngleLines2D( const Line2d& l1, const Line2d l2) | ||
//{ | ||
// auto mag_l1 = l1.direction().magnitude(); | ||
// auto mag_l2 = l2.direction().magnitude(); | ||
// auto dot = dotProduct(l1.direction(), l2.direction()); | ||
// | ||
// auto theta = acos( fabs(dot) / (mag_l1 * mag_l2)); | ||
// return RadianceToDegrees(theta); | ||
//} | ||
|
||
//float rez::AngleLines3D(const Line& l1, const Line& l2) | ||
//{ | ||
// auto mag_l1 = l1.direction().magnitude(); | ||
// auto mag_l2 = l2.direction().magnitude(); | ||
// auto dot = dotProduct(l1.direction(), l2.direction()); | ||
// | ||
// auto theta = acos(fabs(dot) / (mag_l1 * mag_l2)); | ||
// return RadianceToDegrees(theta); | ||
//} | ||
|
||
//float rez::AngleLinePlane(const Line& l, const Planef p) | ||
//{ | ||
// auto dot = dotProduct(l.direction(), p.getNormal()); | ||
// auto theta = acos(fabs(dot)); | ||
// theta = RadianceToDegrees(theta); | ||
// return 90- theta; | ||
//} | ||
|
||
using namespace rez; | ||
|
||
template<class T, size_t dimensions > | ||
static float getAngle(rez::Vector<T, dimensions> v1, rez::Vector<T, dimensions> v2) | ||
{ | ||
auto dot = dotProduct(v1, v2); | ||
auto theta = acos(fabs(dot)); | ||
return RadianceToDegrees(theta); | ||
} | ||
|
||
float rez::AngleLines2D(const Line2d& l1, const Line2d l2) | ||
{ | ||
return getAngle(l1.direction(), l2.direction()); | ||
} | ||
|
||
float rez::AngleLines3D(const Line& l1, const Line& l2) | ||
{ | ||
return getAngle(l1.direction(), l2.direction()); | ||
} | ||
|
||
float rez::AngleLinePlane(const Line& l, const Planef p) | ||
{ | ||
auto theta = getAngle(l.direction(), p.getNormal()); | ||
return 90 - theta; | ||
} | ||
|
||
float rez::AnglePlanes(const Planef p1, const Planef p2) | ||
{ | ||
return getAngle(p1.getNormal(), p2.getNormal()); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
// | ||
// Created by Ryan.Zurrin001 on 12/15/2021. | ||
// | ||
|
||
#ifndef PHYSICSFORMULA_ANGLE_H | ||
#define PHYSICSFORMULA_ANGLE_H | ||
#include "Line.h" | ||
#include "Plane.h" | ||
|
||
namespace rez { | ||
float AngleLines2D(const Line2d& l1, const Line2d l2); | ||
|
||
float AngleLines3D(const Line& l1, const Line& l2); | ||
|
||
float AngleLinePlane(const Line& l, const Planef p); | ||
|
||
float AnglePlanes(const Planef p1, const Planef p2); | ||
}; | ||
#endif //PHYSICSFORMULA_ANGLE_H | ||
// | ||
// Created by Ryan.Zurrin001 on 12/15/2021. | ||
// | ||
|
||
#ifndef PHYSICSFORMULA_ANGLE_H | ||
#define PHYSICSFORMULA_ANGLE_H | ||
#include "Line.h" | ||
#include "Plane.h" | ||
|
||
namespace rez { | ||
float AngleLines2D(const Line2d& l1, const Line2d l2); | ||
|
||
float AngleLines3D(const Line& l1, const Line& l2); | ||
|
||
float AngleLinePlane(const Line& l, const Planef p); | ||
|
||
float AnglePlanes(const Planef p1, const Planef p2); | ||
}; | ||
#endif //PHYSICSFORMULA_ANGLE_H |