Hi,
If your curve is derived from datasets in a worksheet, then easiest is to use the Sort() method in curvebase class.
Say you have your X, Y data in columns 1 and 2 of the active worksheet and your X is in descending order and you want to flip so that X becomes asending order and Y is properly arranged as well. You can then use code such as:
void sort_curve()
{
Worksheet wks = Project.ActiveLayer();
Curve crv(wks, 0, 1);
crv.Sort();
}
The key is to use the correct Curve constructor. Note that some curve constructors (such as creating curve using dataset name) make a copy and then in that case original curve does not get changed.
Easwar
OriginLab