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

.NET (Core and Framework)

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