class segment

A class for the parametric representation of a line segment in 2-D.

Public Fields

[more]bool periodic
set this to true if segment closes upon itself
[more]double tmin
min of time-like parameter
[more]double tmax
max of time-like parameter
[more]double xg
x position of centre of gravity
[more]double yg
y position of centre of gravity
[more]double length
typical length scale of segment

Public Methods

[more] segment()
Constructor.
[more] segment(const Vec &t_in, const Vec &x_in, const Vec &y_in, bool periodic_in=false)
Constructor.
[more]bool operator==(const segment &sb)
Identity (check is based on memory address, thus the test returns false if the two objects have the same (t, x, y) support but are not the same instance).
[more]void load(const Vec &t_in, const Vec &x_in, const Vec &y_in, bool periodic_in=true)
Build object.
[more]void plot(bool hold=true, bool display=true, bool freshstart=true)
Simple 2-D plot.
[more]double x(const double &ti)
Get x at ti.
[more]Vec x(const Vec &ti)
Get x at ti.
[more]double y(const double &ti)
Get y at ti.
[more]Vec y(const Vec &ti)
Get y at ti.
[more]double xDot(const double &ti)
Get dx/dt at ti.
[more]Vec xDot(const Vec &ti)
Get dx/dt at ti.
[more]double yDot(const double &ti)
Get dy/dt at ti.
[more]Vec yDot(const Vec &ti)
Get dy/dt at ti.
[more]double arcLengthIntegral(double (f)(double* ))
Get integral dl*f(t) over segment.
[more]double arcLengthIntegral(double (f)(double* ), const double &ti)
Get integral dl*f(t) up to ti.
[more]Vec arcLengthIntegral(double (f)(double* ), const Vec &ti)
Get integral dl*f(t) up to ti.
[more]double arcLength(void)
Get the arc length.
[more]double arcLength(const double &ti)
Get the arc length up to ti.
[more]Vec arcLength(const Vec &ti)
Get the arc length up to ti.
[more]double arcLengthDot(const double &ti)
Get dl/dt at ti.
[more]Vec arcLengthDot(const Vec &ti)
Get dl/dt at ti.


Documentation

A class for the parametric representation of a line segment in 2-D. Segment uses a cubic spline representation of x(t) and y(t) where t is the parametric variable and plays the role of a time-like variable. Segment has methods to compute the derivative of x and y versus t at any point. Likewise, there are methods to compute the arc length and other integrals.
obool periodic
set this to true if segment closes upon itself

odouble tmin
min of time-like parameter

odouble tmax
max of time-like parameter

odouble xg
x position of centre of gravity

odouble yg
y position of centre of gravity

odouble length
typical length scale of segment

o segment()
Constructor.
See Also:
load

o segment(const Vec &t_in, const Vec &x_in, const Vec &y_in, bool periodic_in=false)
Constructor. Similar to calling segment() followed by load method.
Parameters:
t_in - time-like sampling (must be in increasing order)
x_in - x positions
y_in - y positions
periodic_in - set this to true if segment closes upon itself
See Also:
load

obool operator==(const segment &sb)
Identity (check is based on memory address, thus the test returns false if the two objects have the same (t, x, y) support but are not the same instance).
Parameters:
other - segment

ovoid load(const Vec &t_in, const Vec &x_in, const Vec &y_in, bool periodic_in=true)
Build object. Use this method if nor argument c'tor was used.
Parameters:
t_in - time-like slices (must be in increasing order)
x_in - x positions
y_in - y positions
periodic_in - set this to true if segment closes upon itself
See Also:
segment()

ovoid plot(bool hold=true, bool display=true, bool freshstart=true)
Simple 2-D plot.
Parameters:
- hold set this to true if several segment plots are to overlap
- display set this to true to have window popping up
- freshstart set this to true to erase any previously stored plot object

odouble x(const double &ti)
Get x at ti. Uses a cubic spline interpolation to get the coordinate.
Parameters:
ti - 'time'
Returns:
x position

oVec x(const Vec &ti)
Get x at ti. Uses a cubic spline interpolation to get the coordinate.
Parameters:
ti - 'time'
Returns:
x position

odouble y(const double &ti)
Get y at ti. Uses a cubic spline interpolation to get the coordinate.
Parameters:
ti - 'time'
Returns:
y position

oVec y(const Vec &ti)
Get y at ti. Uses a cubic spline interpolation to get the coordinate.
Parameters:
ti - 'time'
Returns:
y position

odouble xDot(const double &ti)
Get dx/dt at ti. Uses a cubic spline interpolation to get the coordinate.
Parameters:
ti - 'time'
Returns:
xt = dx/dt

oVec xDot(const Vec &ti)
Get dx/dt at ti. Uses a cubic spline interpolation to get the coordinate.
Parameters:
ti - 'time'
Returns:
xt = dx/dt

odouble yDot(const double &ti)
Get dy/dt at ti. Uses a cubic spline interpolation to get the coordinate.
Parameters:
ti - 'time'
Returns:
yt = dy/dt

oVec yDot(const Vec &ti)
Get dy/dt at ti. Uses a cubic spline interpolation to get the coordinate.
Parameters:
ti - 'time'
Returns:
yt = dy/dt

odouble arcLengthIntegral(double (f)(double* ))
Get integral dl*f(t) over segment. Here, dl is the infinitesimal arc length element.
Parameters:
f - integrand
Returns:
integral = integral dl*f(t)

odouble arcLengthIntegral(double (f)(double* ), const double &ti)
Get integral dl*f(t) up to ti. Here, dl is the infinitesimal arc length element.
Parameters:
f - integrand
ti - right end point
Returns:
integral = integral dl*f(t) to ti

oVec arcLengthIntegral(double (f)(double* ), const Vec &ti)
Get integral dl*f(t) up to ti. Here, dl is the infinitesimal arc length element.
Parameters:
f - integrand
ti - right end point
Returns:
integral = integral dl*f(t) to ti

odouble arcLength(void)
Get the arc length. Equivalent to integral dl. Here, dl is the infinitesimal arc element.
Returns:
integral = integral dl over segment

odouble arcLength(const double &ti)
Get the arc length up to ti. Equivalent to integral dl over[tmin, ti].
Parameters:
ti - right end point
Returns:
integral = integral dl over segment

oVec arcLength(const Vec &ti)
Get the arc length up to ti. Equivalent to integral dl over[tmin, ti].
Parameters:
ti - right end point
Returns:
integral = integral dl over segment

odouble arcLengthDot(const double &ti)
Get dl/dt at ti. Here, dl is the infinitesimal arc length element.
Parameters:
ti - 'time'
Returns:
lt the derivative dl/dt l is the arc length

oVec arcLengthDot(const Vec &ti)
Get dl/dt at ti.
Parameters:
ti - 'time'
Returns:
lt the derivative dl/dt l is the arc length


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.