<
classCurve>
72 void Draw(
float error,
size_tmin_segs,
123 floatu_hi,
const TPoint& pos_hi,
124 float error)
const;
128 size_tspokes,
floatradius,
TRing& ring)
const;
132 template<
classCurve>
142 template<
classCurve>
150 template<
classCurve>
158 template<
classCurve>
167 template<
classCurve>
175 template<
classCurve>
183 template<
classCurve>
187Draw(GetError(), 2,
mode);
191 template<
classCurve>
195 floatu_step = 1.0f / min_segs;
197 TPointpos0 = EvalPos(0.0f);
199 static constGLenum modes[] ={
205glPolygonMode(GL_FRONT_AND_BACK, modes[
mode]);
208 TPointnorm(0.0f, 1.0f, 0.0f);
209 TPointaxis = EvalPos(0.01f) - EvalPos(0.0f);
211 if(norm.
Dot(axis) < 0.0001f) {
212norm =
TPoint(0.0f, 0.0f, 1.0f);
215norm = axis.
Cross(norm);
218x_GetRing(0, norm, m_Spokes, m_Start, ring);
220 for(u = 0; u < 1.0f; u += u_step) {
221 TPointpos1 = EvalPos(u + u_step);
222x_DrawRecursive(u, pos0, norm, ring, u+u_step, pos1,
error);
234 template<
classCurve>
238 floatu_hi,
const TPoint& pos_hi,
241u_hi =
min(u_hi, 1.0f);
244 floatu_mid = (u_lo + u_hi) * 0.5f;
245 TPointpos_mid = EvalPos(u_mid);
248 floatlen0 = (pos_lo - pos_hi).Length();
249 floatlen1 = (pos_mid - pos_lo).Length() + (pos_hi - pos_mid).Length();
251 TPointaxis_hi_mid(pos_hi - pos_mid);
253norm_hi = norm_hi.
Cross(axis_hi_mid);
255 TPointnorm_mid(norm_hi + norm_lo);
259 if((len1 - len0) / len0 >
error) {
261x_DrawRecursive(u_lo, pos_lo, norm_lo, ring, u_mid, pos_mid,
error);
262x_DrawRecursive(u_mid, pos_mid, norm_mid, ring, u_hi, pos_hi,
error);
267x_GetRing(u_hi, norm_hi, m_Spokes,
268m_Start + u_hi * (m_End - m_Start),
282glBegin(GL_QUAD_STRIP);
284 typenameTRing::const_iterator this_iter = ring.begin();
285 typenameTRing::const_iterator next_iter =
next.begin();
286 for( ; this_iter != ring.end(); ++this_iter, ++next_iter) {
287glNormal3fv(this_iter->norm.GetData());
288glVertex3fv(this_iter->pos.GetData());
290glNormal3fv(next_iter->norm.GetData());
291glVertex3fv(next_iter->pos.GetData());
303 template<
classCurve>
306 size_tspokes,
floatradius,
309 floatu1 = u + 0.005f;
314 TPointstart = EvalPos(u);
316 TPointaxis = start - end;
324ring.reserve(spokes + 1);
325 for(
size_t i=0;
i< spokes; ++
i) {
327rp.
pos= start + nv;
334ring.push_back(ring.front());
338 template<
classCurve>
346 template<
classCurve>
350 returnm_Curve.GetError();
354 template<
classCurve>
358m_Curve.SetError(
f);
362 template<
classCurve>
366 returnm_Curve.GetPoint(
i);
370 template<
classCurve>
374 returnm_Curve.SetPoint(
i);
378 template<
classCurve>
382m_Curve.SetPoint(
i, point);
386 template<
classCurve>
390 returnm_Curve.EvalPos(u);
394 template<
classCurve>
398 returnm_Curve.EvalTan(u);
402 template<
classCurve>
406 returnm_Curve.EvalCurve(u);
class ICurve defines a basic interface for all curves.
Include a standard set of the NCBI C++ Toolkit most basic headers.
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
CVect3< T > Cross(const CVect3< T > &) const
T Dot(const CVect3< T > &) const
void Rotate(CVect3< float > &point) const
float GetStartRadius(void) const
non-curve specifics
void SetStartRadius(float f)
void Draw(ERenderMode mode=eRender_Default) const
draw!
size_t GetNumSpokes(void) const
void x_DrawRecursive(float u_lo, const TPoint &pos_lo, TPoint &norm_lo, TRing &ring_lo, float u_hi, const TPoint &pos_hi, float error) const
internal (recursive) draw function this implements a subdivision with an error level
float GetEndRadius(void) const
TPoint EvalPos(float u) const
void SetEndRadius(float f)
TPoint EvalTan(float u) const
void SetNumSpokes(size_t spokes)
float GetError() const
access the level of detail
TPoint & SetPoint(size_t i)
void Recalc()
recalculate the curve (curve-specific)
const TPoint & GetPoint(size_t i) const
access control points of the curve
void x_GetRing(float u, const TPoint &normal, size_t spokes, float radius, TRing &ring) const
TPoint EvalCurve(float u) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4