29 virtual void SetDelta(
int variable,
double delta) = 0;
30 virtual void AddDelta(
int variable,
double delta) = 0;
47 { _value = v._value; _delta = v._delta;
return *
this; }
51 virtual void SetDelta(
int variable,
double delta)
override
55 case 0: _delta = osg::Vec3d(delta, 0.0, 0.0);
break;
56 case 1: _delta = osg::Vec3d(0.0, delta, 0.0);
break;
57 case 2: _delta = osg::Vec3d(0.0, 0.0, delta);
break;
60 virtual void AddDelta(
int variable,
double delta)
override
64 case 0: _value += osg::Vec3d(delta, 0.0, 0.0);
break;
65 case 1: _value += osg::Vec3d(0.0, delta, 0.0);
break;
66 case 2: _value += osg::Vec3d(0.0, 0.0, delta);
break;
71 _delta = osg::Vec3d(0.0, 0.0, 0.0);
89 { _value = v._value; _delta = v._delta;
return *
this; }
93 virtual void SetDelta(
int variable,
double delta)
override
97 case 0: _delta = osg::Vec2d(delta, 0.0);
break;
98 case 1: _delta = osg::Vec2d(0.0, delta);
break;
101 virtual void AddDelta(
int variable,
double delta)
override
105 case 0: _value += osg::Vec2d(delta, 0.0);
break;
106 case 1: _value += osg::Vec2d(0.0, delta);
break;
111 _delta = osg::Vec2d(0.0, 0.0);
129 { _value = f._value; _delta = f._delta;
return *
this; }
133 virtual void SetDelta(
int variable,
double delta)
override
137 case 0: _delta = delta;
break;
140 virtual void AddDelta(
int variable,
double delta)
override
144 case 0: _value += delta;
break;
163 VariableQuat(): _value(0.0, osg::Vec3d(1.0, 0.0, 0.0)), _delta(0.0, osg::Vec3d(1.0, 0.0, 0.0)) {}
167 { _value = v._value; _delta = v._delta;
return *
this; }
171 virtual void SetDelta(
int variable,
double delta)
override
175 case 0: _delta = osg::Quat(delta, osg::Vec3d(1.0, 0.0, 0.0));
break;
176 case 1: _delta = osg::Quat(delta, osg::Vec3d(0.0, 1.0, 0.0));
break;
177 case 2: _delta = osg::Quat(delta, osg::Vec3d(0.0, 0.0, 1.0));
break;
180 virtual void AddDelta(
int variable,
double delta)
override
184 case 0: _value = _value * osg::Quat(delta, osg::Vec3d(1.0, 0.0, 0.0)); _value /= _value.length();
break;
185 case 1: _value = _value * osg::Quat(delta, osg::Vec3d(0.0, 1.0, 0.0)); _value /= _value.length();
break;
186 case 2: _value = _value * osg::Quat(delta, osg::Vec3d(0.0, 0.0, 1.0)); _value /= _value.length();
break;
191 _delta = osg::Quat(0.0, osg::Vec3d(1.0, 0.0, 0.0));
209 double _dist_line(osg::Vec3d v, osg::Vec3d l1, osg::Vec3d l2)
213 double denom = (l1-l2).
length();
214 double numer = ((v-l1) ^ (v-l2)).
length();
215 if (denom < 1e-9)
return (v-l2).length();
216 if (numer < 1e-9)
return 0.00;
217 return numer / denom;