|
24 | 24 | #include <geode/geometry/basic_objects/infinite_line.hpp> |
25 | 25 |
|
26 | 26 | #include <geode/geometry/basic_objects/segment.hpp> |
| 27 | +#include <geode/geometry/perpendicular.hpp> |
| 28 | +#include <geode/geometry/vector.hpp> |
27 | 29 |
|
28 | 30 | namespace geode |
29 | 31 | { |
@@ -68,12 +70,16 @@ namespace geode |
68 | 70 | return direction_; |
69 | 71 | } |
70 | 72 | template < typename PointType, index_t dimension > |
71 | | - double GenericLine< PointType, dimension >::line_constant() const |
| 73 | + template < index_t T > |
| 74 | + typename std::enable_if< T == 2, double >::type |
| 75 | + GenericLine< PointType, dimension >::line_constant() const |
72 | 76 | { |
73 | 77 | double line_constant{ 0.0 }; |
74 | | - for( const auto i : LRange{ 2 } ) |
| 78 | + const auto perpendicular_direction = perpendicular( direction() ); |
| 79 | + for( const auto i : LRange{ dimension } ) |
75 | 80 | { |
76 | | - line_constant -= origin().value( i ) * direction().value( i ); |
| 81 | + line_constant -= |
| 82 | + origin().value( i ) * perpendicular_direction.value( i ); |
77 | 83 | } |
78 | 84 | return line_constant; |
79 | 85 | } |
@@ -206,4 +212,9 @@ namespace geode |
206 | 212 | template class opengeode_geometry_api Ray< 1 >; |
207 | 213 | template class opengeode_geometry_api Ray< 2 >; |
208 | 214 | template class opengeode_geometry_api Ray< 3 >; |
| 215 | + |
| 216 | + template opengeode_geometry_api double |
| 217 | + GenericLine< Point< 2 >, 2 >::line_constant< 2 >() const; |
| 218 | + template opengeode_geometry_api double |
| 219 | + GenericLine< RefPoint< 2 >, 2 >::line_constant< 2 >() const; |
209 | 220 | } // namespace geode |
0 commit comments