blob: 55a84aa87c97294d5511d2a596d51f18df2a6f09 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/*
* CurvedElement.cc
*
* Created on: Mar 22, 2011
* Author: jakob
*/
#include <math.h>
#include "CurvedElement.h"
namespace vhc {
CurvedElement::CurvedElement(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double curvature, Element* next):
Element(entry, exit, sectionRadius, next),
curvature(curvature),
curvatureCenter(Vector3D::Null) {
double k = curvature;
Vector3D midpoint = (getEntryPosition() + getExitPosition())/ 2;
curvatureCenter = midpoint + sqrt(1.0 - (k * k) / 4 * getDiagonal().normSquare()) * (getDiagonal().unit().cross(Vector3D::k));
}
}
|