12 #ifndef GLVIS_VSDATA_HPP
13 #define GLVIS_VSDATA_HPP
29 double phi, theta, rho;
31 void CartesianToSpherical();
32 void SphericalToCartesian();
36 double phi_step, theta_step, rho_step;
39 Plane(
double A,
double B,
double C,
double D);
41 inline double Transform(
double x,
double y,
double z)
42 {
return eqn[0]*x+eqn[1]*y+eqn[2]*z+eqn[3]; }
44 {
return eqn[0]*x[0]+eqn[1]*x[1]+eqn[2]*x[2]+eqn[3]; }
50 void IncreaseDistance();
51 void DecreaseDistance();
96 void PrintLogscale(
bool warn);
103 unit_a = 1.0/log(maxv/minv), log_a = (maxv - minv)*unit_a;
107 unit_a = 1.0/(maxv - minv), log_a = 1.0;
110 double _ULogVal(
const double &u) {
return minv*pow(maxv/minv, u); }
112 {
return (logscale ? _ULogVal(u) : minv + (maxv - minv)*u); }
115 return ((logscale && z >= minv && z <= maxv) ?
116 (log(z/minv)*unit_a) : (z - minv)*unit_a);
118 double _LogVal_(
const double &z) {
return (log(z/minv)*log_a + minv); }
120 {
return ((z >= minv && z <= maxv) ? _LogVal_(z) : (z)); }
121 double LogVal(
const double &z,
const bool &log_val)
122 {
return (log_val ? _LogVal(z) : z); }
125 void FixValueRange();
139 : a_label_x(
"x"), a_label_y(
"y"), a_label_z(
"z") {}
148 virtual void SetNewScalingFromBox();
153 virtual void FindNewBox(
bool prepare) = 0;
157 virtual void FindNewValueRange(
bool prepare) = 0;
161 { FindNewBox(prepare); FindNewValueRange(prepare); }
171 void DoAutoscale(
bool prepare);
173 void DoAutoscaleValue(
bool prepare);
175 virtual void Prepare() = 0;
176 virtual void PrepareLines() = 0;
181 virtual void UpdateLevelLines() = 0;
182 virtual void UpdateValueRange(
bool prepare) = 0;
183 void SetValueRange(
double,
double);
185 virtual void SetShading(
int,
bool) = 0;
186 virtual void SetRefineFactors(
int,
int) = 0;
189 auto_ref_max = max_ref;
190 auto_ref_max_surf_elem = max_surf_elem;
192 virtual void AutoRefine() = 0;
193 virtual void ToggleAttributes(Array<int> &attr_list) = 0;
195 virtual void PrintState();
212 virtual void glTF_Export();
217 void SetLevelLines(
double min,
double max,
int n,
int adj = 1);
220 double px,
double py,
double pz,
221 double vx,
double vy,
double vz,
double length,
222 double cone_scale = 0.075);
224 double px,
double py,
double pz,
225 double vx,
double vy,
double vz,
227 double cone_scale = 0.075);
229 double px,
double py,
double pz,
230 double vx,
double vy,
double vz,
232 double cone_scale = 0.075);
234 void DrawPolygonLevelLines(
gl3::GlBuilder& builder,
double *point,
int n,
235 Array<double> &level,
bool log_vals);
238 void SetLight(
bool light_set) { use_light = light_set; }
244 static const int next[2][3] = { { 1, 2, 0 }, { 2, 0, 0 } };
249 void PrepareCaption();
251 void PrepareColorBar(
double minval,
double maxval,
252 Array<double> * level = NULL,
253 Array<double> * levels = NULL);
255 void SetAxisLabels(
const char * a_x,
const char * a_y,
const char * a_z);
260 drawaxes = (drawaxes+1)%4;
268 { scaling = !scaling; SetNewScalingFromBox(); }
270 virtual void ToggleLogscale(
bool print);
273 void RulerPosition();
275 void PrepareRuler(
bool log_z);
277 void ToggleTexture();
281 void SetAutoscale(
int _autoscale);
285 void ShrinkPoints(DenseMatrix &pointmat,
int i,
int fn,
int di);
289 void ComputeBdrAttrCenter();
291 void ComputeElemAttrCenter();
double _LogVal(const double &z)
double LogVal(const double &z)
double Transform(double x, double y, double z)
gl3::GlDrawable caption_buf
gl3::GlDrawable coord_cross_buf
double LogVal(const double &z, const bool &log_val)
virtual std::string GetHelpString() const
double LogUVal(const double &z)
virtual void EventUpdateColors()
thread_local string plot_caption
void SetLight(bool light_set)
double shrinkmat
Shrink factor with respect to the element (material) attributes centers.
double _ULogVal(const double &u)
virtual void EventUpdateBackground()
double _LogVal_(const double &z)
void ToggleDrawColorbar()
vector< gl3::GlDrawable * > updated_bufs
VisualizationSceneScalarData()
int auto_ref_max_surf_elem
double ULogVal(const double &u)
Crude fixed-function OpenGL emulation helper.
virtual void FindNewBoxAndValueRange(bool prepare)
thread_local string extra_caption
gl3::GlDrawable color_bar
double Transform(double *x)
void SetAutoRefineLimits(int max_ref, int max_surf_elem)
virtual void PrepareRuler()
gl3::GlDrawable ruler_buf
virtual void FindMeshBox(bool prepare)