HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TsRegressionPreventer Class Reference

#include <regressionPreventer.h>

Classes

class  SetResult
 Details of the result of an interactive Set call. More...
 

Public Member Functions

TS_API TsRegressionPreventer (TsSpline *spline, TsTime activeKnotTime, bool limit=true)
 
TS_API TsRegressionPreventer (TsSpline *spline, TsTime activeKnotTime, InteractiveMode mode, bool limit=true)
 
TS_API bool Set (const TsKnot &proposedActiveKnot, SetResult *resultOut=nullptr)
 

Friends

struct Ts_RegressionPreventerBatchAccess
 

Detailed Description

An authoring helper class that enforces non-regression in splines.

See page_ts_regression for a general introduction to regression and anti-regression.

Construct an instance of this class when a knot is being interactively edited. Call Set for each change.

Bug:
This class does not yet work correctly with inner loops (TsLoopParams).

Definition at line 35 of file regressionPreventer.h.

Constructor & Destructor Documentation

TS_API TsRegressionPreventer::TsRegressionPreventer ( TsSpline spline,
TsTime  activeKnotTime,
bool  limit = true 
)

Constructor for interactive use (repeated calls to Set). The mode will be determined by the value of TsSpline::GetAntiRegressionAuthoringMode() at the time of construction. If 'limit' is true, adjustments will be enforced before knots are written to the spline. Otherwise, knots will be written without adjustment, but the SetResult will describe the adjustments that would be made. The spline must remain valid for the lifetime of this object.

TS_API TsRegressionPreventer::TsRegressionPreventer ( TsSpline spline,
TsTime  activeKnotTime,
InteractiveMode  mode,
bool  limit = true 
)

Same as the above, but with an InteractiveMode. This form ignores GetAntiRegressionAuthoringMode(), because interactive modes can't be specified through that mechanism, since they apply only to RegressionPreventer.

Member Function Documentation

TS_API bool TsRegressionPreventer::Set ( const TsKnot proposedActiveKnot,
SetResult resultOut = nullptr 
)

Set an edited version of the active knot into the spline, adjusting tangent widths if needed, based on the mode. Any aspect of the active knot may be changed; the aspects that affect regression are knot time and tangent widths. Returns true on success, false on failure.

If this is the first call to Set, and the spline was initially regressive, the opposite tangent may be shortened, in a way that isn't required when the spline starts out non-regressive. In Contain mode, this initial anti-regression will limit the opposite tangent following the usual Contain rules. In any other mode, initial anti-regression will behave as though Limit Opposite were in effect: the opposite tangent will be shortened so that the spline is not regressive given the initial active knot, or to 1/3 of the interval if the active tangent is longer than 4/3 of the interval.

When knot time is changed, the tangent widths in the altered segments on either side are adjusted to prevent regression. If knot time is changed to match another existing knot, the prior knot is removed, and the active knot substituted for it; this is undone if the time is again changed. If knot time changes enough to alter the sort order of knots in the spline, the active knot's neighbor knots will be recomputed for the new insert point, and the resulting new segments will be adjusted to prevent regression as needed.

When a loop-prototype knot is being edited, the spline's loop parameters may fall out of sync if the knot time is changed. This can include the knot drifting out of the prototype interval and becoming hidden; it can also include the prototype interval bounds failing to track the first or last prototype knot as it moves. Clients should make policy as to how this situation should be handled. If loop parameters are going to be updated to match moved knots, that edit should be done before calling Set.

Friends And Related Function Documentation

friend struct Ts_RegressionPreventerBatchAccess
friend

Definition at line 151 of file regressionPreventer.h.


The documentation for this class was generated from the following file: