Click here to Skip to main content
15,889,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: " System.UriFormatException: Invalid URI : The format of the URI could not be determined " Pin
ChinnuKodali15088-Jul-13 10:41
professionalChinnuKodali15088-Jul-13 10:41 
GeneralRe: " System.UriFormatException: Invalid URI : The format of the URI could not be determined " Pin
Pete O'Hanlon8-Jul-13 10:44
mvePete O'Hanlon8-Jul-13 10:44 
QuestionMaths for bouncing a ball around a window.. Pin
Kevin Bewley8-Jul-13 4:42
Kevin Bewley8-Jul-13 4:42 
AnswerRe: Maths for bouncing a ball around a window.. Pin
NickPace8-Jul-13 5:10
NickPace8-Jul-13 5:10 
GeneralRe: Maths for bouncing a ball around a window.. Pin
Kevin Bewley8-Jul-13 5:19
Kevin Bewley8-Jul-13 5:19 
GeneralRe: Maths for bouncing a ball around a window.. Pin
NickPace8-Jul-13 5:25
NickPace8-Jul-13 5:25 
GeneralRe: Maths for bouncing a ball around a window.. Pin
Kevin Bewley8-Jul-13 5:46
Kevin Bewley8-Jul-13 5:46 
GeneralRe: Maths for bouncing a ball around a window.. Pin
harold aptroot8-Jul-13 6:00
harold aptroot8-Jul-13 6:00 
It seems at a first glance that it can only bounce once in one timestep, but it can in fact bounce multiple times in succession in one timestep. If you take any shortcuts there, balls can "escape", usually through the corners, and it will be uncommon enough that it could go undetected essentially forever (you can use that to decide that it's really OK, or that it's a very nasty bug, but it's good to be aware of it). If the speeds of the balls are reasonably low and the timestep is reasonably short, balls can still bounce twice, in the corners.
Also, the simple implementation of bouncing actually bounces off of a virtual surface some distance outside the box depending on how far the ball traveled outside in a step. A more correct way to implement it is calculating the intersection of the box with the half-line in the direction that the ball is traveling, then bouncing "some time in the past when it was at that position" (flipping a speed and, crucially, updating the balls position by mirroring it around the line it bounced into*), then looping until the ball is inside the box. Like the other problem, this effect gets worse and worse for higher speeds and longer time steps.
So yes, it's actually pretty complicated.

* that is why you calculate the intersection point - to get the line it first bounced into. There would otherwise be an ambiguity when the ball is in the "outside quadrant" of a corner.

modified 8-Jul-13 12:28pm.

AnswerRe: Maths for bouncing a ball around a window.. Pin
Keld Ølykke8-Jul-13 20:11
Keld Ølykke8-Jul-13 20:11 
QuestionWebException timeout Problem. Pin
vishalmudrale8-Jul-13 4:04
vishalmudrale8-Jul-13 4:04 
QuestionRe: WebException timeout Problem. Pin
Eddy Vluggen8-Jul-13 4:59
professionalEddy Vluggen8-Jul-13 4:59 
AnswerRe: WebException timeout Problem. Pin
vishalmudrale8-Jul-13 20:20
vishalmudrale8-Jul-13 20:20 
QuestionRe: WebException timeout Problem. Pin
vishalmudrale8-Jul-13 20:21
vishalmudrale8-Jul-13 20:21 
AnswerRe: WebException timeout Problem. Pin
Eddy Vluggen9-Jul-13 0:22
professionalEddy Vluggen9-Jul-13 0:22 
GeneralRe: WebException timeout Problem. Pin
vishalmudrale9-Jul-13 0:40
vishalmudrale9-Jul-13 0:40 
GeneralRe: WebException timeout Problem. Pin
Eddy Vluggen9-Jul-13 3:03
professionalEddy Vluggen9-Jul-13 3:03 
QuestionDeveloping a Point of Sale System for Reataurant/Hotel Pin
MohdWaseem8-Jul-13 3:46
MohdWaseem8-Jul-13 3:46 
AnswerRe: Developing a Point of Sale System for Reataurant/Hotel Pin
Manfred Rudolf Bihy8-Jul-13 4:46
professionalManfred Rudolf Bihy8-Jul-13 4:46 
AnswerRe: Developing a Point of Sale System for Reataurant/Hotel Pin
Dave Kreskowiak8-Jul-13 5:18
mveDave Kreskowiak8-Jul-13 5:18 
AnswerRe: Developing a Point of Sale System for Reataurant/Hotel Pin
Walt Dexter8-Jul-13 7:21
Walt Dexter8-Jul-13 7:21 
AnswerRe: Developing a Point of Sale System for Reataurant/Hotel Pin
Bernhard Hiller8-Jul-13 23:12
Bernhard Hiller8-Jul-13 23:12 
QuestionMessage Closed Pin
7-Jul-13 11:28
User34907-Jul-13 11:28 
AnswerRe: double.tryparse() Pin
Garth J Lancaster7-Jul-13 12:33
professionalGarth J Lancaster7-Jul-13 12:33 
AnswerRe: double.tryparse() PinPopular
Mycroft Holmes7-Jul-13 13:06
professionalMycroft Holmes7-Jul-13 13:06 
QuestionC# Pin
Manish Kumar1234567-Jul-13 9:56
Manish Kumar1234567-Jul-13 9:56 

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.