1#include <cgv/base/base.h>
2#include "clipped_view.h"
58 double C = -(z_far + z_near) / (z_far - z_near);
59 double D = -2.0*z_far*z_near / (z_far - z_near);
60 return 0.5 - 0.5*(D + C*z_eye) / z_eye;
77 double z_eye = dot(eye, view_dir);
80 z_near_derived = z_near;
81 z_far_derived = z_far;
89 for (
unsigned int i = 1; i<8; ++i) {
99 z_near_derived = z_min;
101 z_far_derived = z_max;
103 if (clip_relative_to_extent) {
104 z_near_derived *= z_near;
105 z_far_derived *= z_far;
108 else if (clip_relative_to_extent) {
109 z_near_derived = y_extent_at_focus*z_near;
110 z_far_derived = y_extent_at_focus*z_far;
virtual void set_scene_extent(const dbox3 &_box)
set the extent of the scene in world coordinates used by the compute_clipping_planes functions to ada...
dbox3 get_scene_extent() const
return the currently set scene extent
double get_z_far() const
return the currently set z-value for the z-far clipping plane
virtual void set_z_near(double z)
set the z-value for the z-near clipping plane
static double get_z_D(double z_eye, double z_near, double z_far)
transform a z value in eye-coordinates (should be negative!) to device coordinate
void compute_clipping_planes(double &z_near_derived, double &z_far_derived, bool clip_relative_to_extent=false) const
compute clipping planes adapted to the current scene extent, z_near_derived is at least z_near and as...
double get_z_near() const
return the currently set z-value for the z-near clipping plane
clipped_view()
construct a parallel view with focus in the world origin looking in negative z-direction and the y-di...
virtual void set_default_view()
reset view with focus and y-extent based on current scene extent
virtual void set_z_far(double z)
set the z-value for the z-far clipping plane
defines a symmetric view with the following quantities:
const dvec3 get_eye() const
query the eye point, which is computed from focus, view dir, y extent at focus and y view angle
virtual void set_view_dir(const dvec3 &vd)
set view direction without ensuring orthogonality to view up direction
virtual void set_y_extent_at_focus(double ext)
set y extent of viewing window at focus point keeping y view angle resulting in a zoom
virtual void set_view_up_dir(const dvec3 &vud)
set view up direction without ensuring orthogonality to view direction
const dvec3 & get_view_dir() const
query current view direction
virtual void set_focus(const dvec3 &foc)
set a new focus point keeping y extent at focus and y view angle fix, such that the eye position is a...
cgv::media::axis_aligned_box< double, 3 > dbox3
declare type of 3d double precision floating point axis-aligned boxes