Laxkit  0.0.7.1
Public Types | Public Member Functions | Public Attributes | Private Member Functions
Laxkit::CurveInfo Class Reference
Inheritance diagram for Laxkit::CurveInfo:
Inheritance graph
[legend]

List of all members.

Public Types

enum  CurveTypes { Linear, Autosmooth, Bezier }

Public Member Functions

 CurveInfo (const char *ntitle, const char *xl, double nxmin, double nxmax, const char *yl, double nymin, double nymax)
virtual const charwhattype ()
virtual void SetXBounds (double nxmin, double nxmax)
virtual void SetYBounds (double nymin, double nymax)
virtual void SetTitle (const char *ntitle)
virtual double f (double x)
virtual double f_linear (double x)
 Return y value for x. Out of range x and y are clamped to bounds.
virtual double f_autosmooth (double x)
 Return y value for x. Out of range x and y are clamped to bounds.
virtual double f_bezier (double x)
 Return y value for x. Out of range x and y are clamped to bounds.
virtual flatpoint MapUnitPoint (flatpoint p)
virtual int AddPoint (double x, double y)
virtual int MovePoint (int index, double x, double y)
virtual void SetSinusoidal (int samples)
virtual void Reset ()
virtual void MakeFakeCurve ()
 Fills fauxpoints with c-v-c-c-v-c...
virtual int MakeLookupTable (int *table, int numentries, int minvalue, int maxvalue)
virtual void RefreshLookup ()
 Refresh the integer approximation lookup table.
virtual void RefreshLookup (int nsamples, int nmin, int nmax)
 Refresh the integer approximation lookup table, adjusting sample size and bounds.
virtual void LookupDump (const char *label, FILE *f)
virtual void dump_out (FILE *f, int indent, int what, anObject *context)
virtual LaxFiles::Attributedump_out_atts (LaxFiles::Attribute *att, int what, anObject *context)
virtual void dump_in_atts (LaxFiles::Attribute *att, int flag, anObject *context)
- Public Member Functions inherited from Laxkit::anObject
 anObject ()
 Set object_id=getUniqueNumber().
virtual ~anObject ()
 Empty virtual destructor.
virtual anObjectduplicate (anObject *ref=NULL)
virtual int inc_count ()
 Increment the data's count by 1. Returns count.
virtual int dec_count ()
 Decrement the count of the data, deleting if count is less than or equal to 0.
virtual int the_count ()
- Public Member Functions inherited from LaxFiles::DumpUtility
virtual void dump_in (FILE *f, int indent, int what, Laxkit::anObject *loadcontext, Attribute **att)
 Read in a file segment as an Attribute, and pass parsing duties to dump_in_atts.
virtual ~DumpUtility ()
 Empty virtual destructor.

Public Attributes

double xmin
double xmax
double ymin
double ymax
charxlabel
charylabel
chartitle
CurveTypes curvetype
int numsamples
int lookup_min
int lookup_max
intlookup
NumStack< flatpointpoints
NumStack< flatpointfauxpoints
- Public Attributes inherited from Laxkit::anObject
int suppress_debug
DeleteRefCountedFunc deleteMe
 Called when the count is decremented to 0.
unsigned long object_id
charobject_idstr

Private Member Functions

void base_init ()

Additional Inherited Members

- Protected Attributes inherited from Laxkit::anObject
int _count
 The reference count of the object.

Detailed Description

Info for x -> y transformation


Member Function Documentation

int Laxkit::CurveInfo::AddPoint ( double  x,
double  y 
)
virtual

x,y are in actual range (as opposed to points space). Point is clamped to proper range.

Return 0 for success.

void Laxkit::CurveInfo::MakeFakeCurve ( )
virtual

Fills fauxpoints with c-v-c-c-v-c...

Basically for each point, push handles that are parallel to a line connecting the points on either side.

Note this is not a very good way to approximate points when there are a lot of points. It does ok for a very sparse collection of points.

References flatvector::normalize().

Referenced by Laxkit::CurveWindow::MouseMove().

int Laxkit::CurveInfo::MakeLookupTable ( int table,
int  numentries,
int  minvalue,
int  maxvalue 
)
virtual

numentries must be 2 or greater. Assumes table is already allocated.

Return -1 for error, or 0 for success.

int Laxkit::CurveInfo::MovePoint ( int  index,
double  x,
double  y 
)
virtual

Adjust existing point. x value is clamped to adjacent bounds.

void Laxkit::CurveInfo::RefreshLookup ( int  nsamples,
int  nmin,
int  nmax 
)
virtual

Refresh the integer approximation lookup table, adjusting sample size and bounds.

If nsamples is > 0, then use that as new sample size and bounds.

void Laxkit::CurveInfo::Reset ( )
virtual

Resets to 2 point linear, 0 to 1 (unmapped). Does NOT change bounds.

Referenced by Laxkit::CurveWindow::Reset().

void Laxkit::CurveInfo::SetSinusoidal ( int  samples)
virtual

Make a sine like curve with max point at minx, min point at maxx. samples needs to be >= 2.


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

Mon Feb 17 2014 11:52:59, Laxkit