Profile Picture

How to transform viewport coordinate to polar coordinate ?

Posted By CHANGMIN KIM 3 Months Ago

How to transform viewport coordinate to polar coordinate ?

Author
Message
CHANGMIN KIM
Question Posted 3 Months Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Months Ago
Posts: 10, Visits: 25
Hi Team,

I want to convert coordinates from the control perspective to coordinates from the chart perspective.
I know how to do this with cartesian chart, but I have no idea on how to do this with polar chart.

to be more specific,

NCartesianChart chart1 = new NCartesianChart();
nChartControl.Charts.Add(chart1);
NPolarChart chart2 = new NPolarChart();
nChartControl.Charts.Add(chart2);

...

// I know how to do this
NVector2DD ViewToCartesianScale(in MouseEventArgs e)
{
    NViewToScale2DTransformation view2Scale =
        new NViewToScale2DTransformation(chart1,
        (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY);
    NVector2DD cartesianCoord = new NVector2DD();
    view2Scale.Transform(new NPointF(e.X, e.Y), ref cartesianCoord);
    return cartesianCoord;
}

// I want to know
void ViewToPolarScale(in MouseEventArgs e, out double angle, out double radius)
{
    ??
}


Thanks,,

Nevron Support
Posted 3 Months Ago
View Quick Profile
Supreme Being

Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)Supreme Being (3,905 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 2,879, Visits: 3,045
Hi Changmin,
The following code shows how to transform from view to polar coordinate:

   NPolarChart polarChart = (NPolarChart)nChartControl1.Charts[0];
    NPointF modelPoint = polarChart.TransformViewToRadialModel(new Nevron.GraphicsCore.NPointF(e.X, e.Y));

    double value = polarChart.Axis(StandardAxis.PolarAngle).Scale.Ruler.ScaleToLogical(modelPoint.X);
    double angle = polarChart.Axis(StandardAxis.Polar).Scale.Ruler.ScaleToLogical(modelPoint.Y);

We hope this helps - let us know if you have any questions.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic