Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 9:01
SledgeHammer0123-Nov-14 9:01 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 9:08
SledgeHammer0123-Nov-14 9:08 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 9:14
SledgeHammer0123-Nov-14 9:14 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:10
SledgeHammer0123-Nov-14 8:10 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:11
SledgeHammer0123-Nov-14 8:11 
GeneralRe: Converting Y up to Y down coordinates Pin
Richard MacCutchan23-Nov-14 22:03
mveRichard MacCutchan23-Nov-14 22:03 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:31
SledgeHammer0123-Nov-14 8:31 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:46
SledgeHammer0123-Nov-14 8:46 
Yeah, I think something is amiss...

List<double> lst = new List<double>();

lst.Add(0);
lst.Add(3);
lst.Add(7);
lst.Add(10);

double dMin = lst.Min();
double dMax = lst.Max();

double dHeight = 30;

//double y = 0; // 29 is correct
double y = 10; // 1.72 not correct

double Y = ((y + Math.Abs(dMin)) * dHeight) / (dMax - dMin + 1);
Y = dHeight - 1 - Y;

System.Diagnostics.Debug.WriteLine(Y);


With the -5 to 15 range, it gets closer, 0.43, so I guess that's a round off... if I truncate everything to ints, it comes out even worse, to 2 instead of 1.72.
AnswerRe: Converting Y up to Y down coordinates Pin
BillWoodruff23-Nov-14 1:00
professionalBillWoodruff23-Nov-14 1:00 
GeneralRe: Converting Y up to Y down coordinates Pin
SledgeHammer0123-Nov-14 8:13
SledgeHammer0123-Nov-14 8:13 
QuestionLooking for books recommendations to learn specifically about DB using .NET and C# Pin
Member 1000166322-Nov-14 8:04
Member 1000166322-Nov-14 8:04 
AnswerRe: Looking for books recommendations to learn specifically about DB using .NET and C# Pin
BillWoodruff22-Nov-14 8:33
professionalBillWoodruff22-Nov-14 8:33 
QuestionIBM - ILog Diagram: Find node position in pixel Pin
hassan faghihi21-Nov-14 22:20
professionalhassan faghihi21-Nov-14 22:20 
QuestionPocketSphinx Pin
Member 1001593821-Nov-14 7:54
Member 1001593821-Nov-14 7:54 
AnswerRe: PocketSphinx Pin
Dave Kreskowiak21-Nov-14 8:39
mveDave Kreskowiak21-Nov-14 8:39 
AnswerRe: PocketSphinx Pin
BillWoodruff21-Nov-14 9:31
professionalBillWoodruff21-Nov-14 9:31 
Questionhow to solve System.OutOf Memory Exception was thrown Pin
cicill21-Nov-14 5:24
cicill21-Nov-14 5:24 
AnswerRe: how to solve System.OutOf Memory Exception was thrown Pin
Eddy Vluggen21-Nov-14 5:35
professionalEddy Vluggen21-Nov-14 5:35 
AnswerRe: how to solve System.OutOf Memory Exception was thrown Pin
OriginalGriff21-Nov-14 5:50
mveOriginalGriff21-Nov-14 5:50 
AnswerRe: how to solve System.OutOf Memory Exception was thrown Pin
hassan faghihi21-Nov-14 22:27
professionalhassan faghihi21-Nov-14 22:27 
QuestionApplication has stopped working error in C# .NET application Pin
eljainc21-Nov-14 4:51
eljainc21-Nov-14 4:51 
AnswerRe: Application has stopped working error in C# .NET application Pin
OriginalGriff21-Nov-14 5:10
mveOriginalGriff21-Nov-14 5:10 
AnswerRe: Application has stopped working error in C# .NET application Pin
Redgum21-Nov-14 5:11
professionalRedgum21-Nov-14 5:11 
AnswerRe: Application has stopped working error in C# .NET application Pin
Richard MacCutchan21-Nov-14 5:12
mveRichard MacCutchan21-Nov-14 5:12 
QuestionRaise RowCommand event of GridView with asynchronous postback Pin
Miroslav Georgiev20-Nov-14 22:33
Miroslav Georgiev20-Nov-14 22:33 

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.