Click here to Skip to main content
15,914,225 members
Home / Discussions / C#
   

C#

 
AnswerRe: text parsing or automatic segmentation of text in c# Pin
Teuz29-Dec-08 6:52
Teuz29-Dec-08 6:52 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
Member 447035429-Dec-08 7:16
Member 447035429-Dec-08 7:16 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
Not Active29-Dec-08 10:56
mentorNot Active29-Dec-08 10:56 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
lawrenceinba29-Dec-08 14:46
lawrenceinba29-Dec-08 14:46 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
lawrenceinba29-Dec-08 14:43
lawrenceinba29-Dec-08 14:43 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
Colin Angus Mackay29-Dec-08 15:03
Colin Angus Mackay29-Dec-08 15:03 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
lawrenceinba29-Dec-08 15:17
lawrenceinba29-Dec-08 15:17 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
Colin Angus Mackay29-Dec-08 15:30
Colin Angus Mackay29-Dec-08 15:30 
AnswerRe: text parsing or automatic segmentation of text in c# Pin
#realJSOP29-Dec-08 9:05
professional#realJSOP29-Dec-08 9:05 
AnswerRe: text parsing or automatic segmentation of text in c# Pin
Colin Angus Mackay29-Dec-08 10:19
Colin Angus Mackay29-Dec-08 10:19 
JokeRe: text parsing or automatic segmentation of text in c# Pin
Pete O'Hanlon29-Dec-08 10:23
mvePete O'Hanlon29-Dec-08 10:23 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
Colin Angus Mackay29-Dec-08 11:52
Colin Angus Mackay29-Dec-08 11:52 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
lawrenceinba29-Dec-08 14:50
lawrenceinba29-Dec-08 14:50 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
Colin Angus Mackay29-Dec-08 14:59
Colin Angus Mackay29-Dec-08 14:59 
QuestionEvenly Space Points On Line Pin
linal29-Dec-08 5:47
linal29-Dec-08 5:47 
AnswerRe: Evenly Space Points On Line Pin
cechode29-Dec-08 7:06
cechode29-Dec-08 7:06 
GeneralRe: Evenly Space Points On Line Pin
Ben Fair29-Dec-08 10:08
Ben Fair29-Dec-08 10:08 
I understood the question as taking a line created by a number of points and creating a new set of points that construct the same line, but with the same number of points evenly distributed across the line. If that is the case, here is a solution. Theoretically, all you need to do is calculate the length of the line and divide it into even segments according to the number of points provided by the user. Where P1 and P2 are the end points of the line, and n is the number of points provided by the user; you can calculate an x offset as (| P1.X - P2.X |) / n and a y offset as (| P1.Y - P2.Y |) / n. You can then construct a collection of points containing the first and last point provided by the user along with an additional n - 2 points (indices 1...n-1) where the X coordinate = P1.X + (index * x offset) and the Y coordinate = P1.Y + (index * y offset).

Pseudocode:
N = userPoints.Count
P1 = userPoints[0]
P2 = userPoints[N - 1]
xOffset = Abs(P1.X - P2.X) / N
yOffset = Abs(P1.Y - P2.Y) / N
List newPoints = new List(N)
newPoints.Add(P1)

For I = 1; I < N - 1; I++
    newPoints.Add(new Point(P1.X + I * xOffset, P1.Y + I * yOffset))

newPoints.Add(P2)


Keep It Simple Stupid! (KISS)

GeneralRe: Evenly Space Points On Line Pin
Luc Pattyn29-Dec-08 10:32
sitebuilderLuc Pattyn29-Dec-08 10:32 
QuestionAdd a Property for a UserControls Pin
Pedram Behroozi29-Dec-08 5:35
Pedram Behroozi29-Dec-08 5:35 
AnswerRe: Add a Property for a UserControls Pin
PIEBALDconsult29-Dec-08 5:43
mvePIEBALDconsult29-Dec-08 5:43 
GeneralRe: Add a Property for a UserControls Pin
Pedram Behroozi29-Dec-08 5:56
Pedram Behroozi29-Dec-08 5:56 
AnswerRe: Add a Property for a UserControls Pin
Member 447035429-Dec-08 8:00
Member 447035429-Dec-08 8:00 
GeneralRe: Add a Property for a UserControls Pin
Pedram Behroozi29-Dec-08 8:11
Pedram Behroozi29-Dec-08 8:11 
GeneralRe: Oops...! Something terrible!!! Pin
Pedram Behroozi29-Dec-08 8:36
Pedram Behroozi29-Dec-08 8:36 
AnswerRe: Oops...! Something terrible!!! Pin
Member 447035429-Dec-08 9:16
Member 447035429-Dec-08 9:16 

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.