Changes in src/Line.cpp [112b09:f932b7]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Line.cpp
r112b09 rf932b7 215 215 } 216 216 217 std::vector<Vector> Line::getSphereIntersections() const{ 218 std::vector<Vector> res; 219 220 // line is kept in normalized form, so we can skip a lot of calculations 221 double discriminant = 1-origin->NormSquared(); 222 // we might have 2, 1 or 0 solutions, depending on discriminant 223 if(discriminant>=0){ 224 if(discriminant==0){ 225 res.push_back(*origin); 226 } 227 else{ 228 Vector helper = sqrt(discriminant)*(*direction); 229 res.push_back(*origin+helper); 230 res.push_back(*origin-helper); 231 } 232 } 233 return res; 234 } 235 217 236 Line makeLineThrough(const Vector &x1, const Vector &x2){ 218 237 if(x1==x2){
Note:
See TracChangeset
for help on using the changeset viewer.