21 e_line = e_line.normal();
26 Vector3D p_ff = p_line + e_line *
dot(focus-p_line, e_line);
27 double q_sq = distance*distance -
dot(focus-p_ff, focus-p_ff);
34 double q = sqrt(q_sq);
62 vup =
cross(vpn, left).normal();
77 j =
cross(k, i).normal();
85 camera = (aMb*R*bMa).coord(camera);
96 double dist = std::max(dist_v, dist_h);
98 Vector3D camera_r_t = focus + vpn*dist;
104 std::vector<double> dists;
105 for (
unsigned x=0; x<2; ++x)
106 for (
unsigned y=0; y<2; ++y)
107 for (
unsigned z=0; z<2; ++z)
114 double maxDist = *std::max_element(dists.begin(), dists.end());
129 double cos_plane_angle =
dot(vpn, vpn_p);
130 d_p = d_p / cos_plane_angle;
137 double beta = (p-pp).
length() / tan(viewAngle/2);
139 double dist = beta +
dot(pp-focus, vpn);
Vector3D corner(int x, int y, int z) const
PlainObject normal() const
static Vector3D findCameraPosOnLineFixedDistanceFromFocus(Vector3D p_line, Vector3D e_line, double distance, Vector3D focus)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Vector3D cross(const Vector3D &a, const Vector3D &b)
compute cross product of a and b.
Transform3D createTransformIJC(const Vector3D &ivec, const Vector3D &jvec, const Vector3D ¢er)
static double findCameraDistanceKeepPointInView(double viewAngle, Vector3D focus, Vector3D vpn, Vector3D p)
#define CX_LOG_CHANNEL_DEBUG(channel)
double dot(const Vector3D &a, const Vector3D &b)
compute inner product (or dot product) of a and b.
static double findCameraDistanceKeepPointInViewOneAxis(Vector3D n, double viewAngle, Vector3D focus, Vector3D vpn, Vector3D p)
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
RealScalar length() const
Transform3D createTransformRotateZ(const double angle)
static double findMaxCameraDistance(Vector3D n, double viewAngle, Vector3D focus, Vector3D vpn, const DoubleBoundingBox3D &bb)
static Vector3D elevateCamera(double angle, Vector3D camera, Vector3D focus, Vector3D vup)
static Vector3D orthogonalize_vup(Vector3D vup, Vector3D vpn, Vector3D vup_fallback)
static Vector3D findCameraPosByZoomingToROI(double viewAngle_vertical, double viewAngle_horizontal, Vector3D focus, Vector3D vup, Vector3D vpn, const DoubleBoundingBox3D &bb)
Namespace for all CustusX production code.