Click here to Skip to main content
15,881,882 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: HOW TO DISTINGUISE POINTS OF LINES AND CURVES ??? Pin
molesworth25-May-09 22:24
molesworth25-May-09 22:24 
GeneralRe: HOW TO DISTINGUISE POINTS OF LINES AND CURVES ??? Pin
TARAK NATH ROY25-May-09 23:08
TARAK NATH ROY25-May-09 23:08 
GeneralRe: HOW TO DISTINGUISE POINTS OF LINES AND CURVES ??? Pin
molesworth25-May-09 23:22
molesworth25-May-09 23:22 
GeneralRe: HOW TO DISTINGUISE POINTS OF LINES AND CURVES ??? Pin
TARAK NATH ROY26-May-09 0:01
TARAK NATH ROY26-May-09 0:01 
GeneralRe: HOW TO DISTINGUISE POINTS OF LINES AND CURVES ??? Pin
TARAK NATH ROY26-May-09 0:03
TARAK NATH ROY26-May-09 0:03 
GeneralRe: HOW TO DISTINGUISE POINTS OF LINES AND CURVES ??? Pin
molesworth26-May-09 1:23
molesworth26-May-09 1:23 
GeneralRe: HOW TO DISTINGUISE POINTS OF LINES AND CURVES ??? Pin
TARAK NATH ROY26-May-09 2:15
TARAK NATH ROY26-May-09 2:15 
GeneralRe: HOW TO DISTINGUISE POINTS OF LINES AND CURVES ??? Pin
molesworth26-May-09 3:05
molesworth26-May-09 3:05 
TARAK NATH ROY wrote:
i have number of points(x,y) near about 1000.If i plot all these points in graph paper then it looks like a polygon.And polygon is combination of lots of curve and lines


OK, I think I understand a bit better now. You have a large list of points, and want to draw a figure from them, using straight lines and curves to best fit the shape. Although to be technically correct, a polygon is a shape made of only straight lines, I get what you mean.

So, you need to go through the list, finding the sections which are best drawn as straight lines, and which are best as curves. My previous suggestion about matching slopes is probably still a reasonable way to try, but over limited ranges of points.

If you calculate the slope between points (Xn, Yn) and (Xn+1, Yn+1) as (Yn+1 - Yn) / (Xn+1 - Xn) then you can compare the slope values as you step through the list (increasing n).

If consecutive slopes are equal, or better, if the difference between them is less than some small constant, then the group of points are all very close to being a straight line. If you get a change in slope, greater than your limit value, then you've entered a curve region.

As you go through the points you can either copy them to separate line and curve lists, or possibly note the indices where the type of line changes.

Drawing the straight lines is easy, however you may have to look at your data more closely to find the best curve drawing method to give a good match.

Here's a rough pseudo-code version of what I'm describing above :-

lastSlope = 0;

for (int n=0; n<numPoints; ++n)
{
    // need to check for dX == 0  and handle array overrun
    slope = (Y[n+1] - Y[n]) / (X[n+1] - X[n]);

    if (abs(slope - lastSlope) < smallValue)
    {
        // now in straight line region
        // add points to straight line list
    }
    else
    {
        // now in curve region
        // add points to curve list
    }

    lastSlope = slope;
}


I hope that helps you a bit... Smile | :)

There are three kinds of people in the world - those who can count and those who can't...

GeneralRe: HOW TO DISTINGUISE POINTS OF LINES AND CURVES ??? Pin
molesworth26-May-09 3:20
molesworth26-May-09 3:20 
QuestionWSE 3.0 setting option is not available Pin
kamaldeepgurhani24-May-09 21:13
kamaldeepgurhani24-May-09 21:13 
QuestionI need to Debug my setup project. Pin
velkumar_in24-May-09 21:05
velkumar_in24-May-09 21:05 
AnswerRe: I need to Debug my setup project. Pin
Moim Hossain2-Jul-09 9:36
Moim Hossain2-Jul-09 9:36 
QuestionHow to run .net application on Macintosh operating system.? Pin
Piyush Vardhan Singh24-May-09 20:45
Piyush Vardhan Singh24-May-09 20:45 
AnswerRe: How to run .net application on Macintosh operating system.? Pin
molesworth25-May-09 0:10
molesworth25-May-09 0:10 
GeneralRe: How to run .net application on Macintosh operating system.? Pin
Piyush Vardhan Singh25-May-09 1:46
Piyush Vardhan Singh25-May-09 1:46 
GeneralRe: How to run .net application on Macintosh operating system.? Pin
molesworth25-May-09 2:03
molesworth25-May-09 2:03 
Question[Message Deleted] Pin
bfis10813724-May-09 2:20
bfis10813724-May-09 2:20 
AnswerRe: help reading stack trace Pin
Luc Pattyn24-May-09 3:10
sitebuilderLuc Pattyn24-May-09 3:10 
AnswerRe: [Message Deleted] Pin
Luc Pattyn25-May-09 2:07
sitebuilderLuc Pattyn25-May-09 2:07 
Questioncrystal report taking long time for preview Pin
srinisiv24-May-09 1:05
srinisiv24-May-09 1:05 
AnswerRe: crystal report taking long time for preview Pin
ISoftwareDev24-May-09 2:09
ISoftwareDev24-May-09 2:09 
GeneralRe: crystal report taking long time for preview Pin
srinisiv24-May-09 20:25
srinisiv24-May-09 20:25 
GeneralRe: crystal report taking long time for preview Pin
Pete O'Hanlon24-May-09 22:28
mvePete O'Hanlon24-May-09 22:28 
GeneralRe: crystal report taking long time for preview Pin
David Mujica22-Jun-09 16:20
David Mujica22-Jun-09 16:20 
QuestionHow to detect the person who will click the print option in windows application??? Pin
manjari kar23-May-09 0:52
manjari kar23-May-09 0:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.