Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Datatypes for physics

Tags:

c#

types

physics

I'm currently designing a program that will involve some physics (nothing too fancy, a few balls crashing to each other)

What's the most exact datatype I can use to represent position (without a feeling of discrete jumps) in c#?

Also, what's the smallest ammount of time I can get between t and t+1? One tick?

EDIT: Clarifying: What is the smallest unit of time in C#? [TimeSpan].Tick?

like image 499
juan Avatar asked Aug 26 '08 19:08

juan


1 Answers

In .Net a decimal will be the most precise datatype that you could use for position. I would just write a class for the position:

public class Position
{
    decimal x;
    decimal y;
    decimal z;
}

As for time, your processor can't give you anything smaller than one tick.

Sounds like an fun project! Good luck!

like image 63
tghw Avatar answered Sep 20 '22 00:09

tghw