• Create Account

# HypnotiC

Member Since 04 Apr 2013
Offline Last Active Sep 21 2016 01:29 PM

### In Topic: Predicting Collision time of Circle-Line segment

22 April 2015 - 07:53 PM

Assume the path of center is C(t) = (x(t), y(t)), line equation is L: ax+by=0, and the current time is t0.

"Translate" the line to find the intersection at t0, say it's P1(x1,y1).

Then at any time t, position of P1 would be P1(t) = C(t) + (x1-x(t0), y1-y(t0)) = (x1(t), y1(t))

Now solve the equation for t1:

a * x1(t1) + b * y1(t1) = 0

And t1 - t0 is the answer

Note we need special handling if line equation is y=0

### In Topic: How would I read/write bit by bit from/to a file?

13 April 2015 - 08:01 PM

Do you really have a need to work on the generated "binary" file at all, e.g. somehow modify or inspect the file through your Hex editor?

If no then why not just store the binaries as std::uint8_t and later read them back as std::uint8_t and convert to 0s and 1s as needed?

### In Topic: how to get unit vector perpendicular to normal surface

31 March 2015 - 07:44 PM

slope being close to 90 degree means almost all gravity is applied to y direction, in which case you should directly use Fz = (0,-1,0)

### In Topic: Same point in another coordinate system

31 March 2015 - 07:32 PM

what you're describing are different "spaces" inside the same coordinate system

How do you differentiate spaces from coordinate systems? I feel they are not 2 distinct entities but rather one is based on the other.

When I see people talking about spaces, I always think of those spaces being backed by some coordinate systems and this is essentially how we construct the matrices to transform something from one space to another.

### In Topic: Collision: rotating line & moving point

10 February 2015 - 10:06 PM

First I think you need to handle the case where there is not collision between the point and the rotating line...

Back to your question. Here is one naïve way (some what similar to what you are doing though):

- Since the line is rotating around a fixed point, you should be able to pre-compute the closed area by this rotation (maybe approximated by a circle).

- If the point is not in this area then no need to test collision. Once the point is in the area, compute the time when it enters the area and when it leaves the area. Call them T0 and T1.

- We know equation of the rotating line and the trajectory of the point (also a line).

- Divide interval [T0, T1] into N sub intervals that are small enough according to your desired precision. Call Ti = T0 + i*N;

- For each Ti, compute the point position, if it's "on" equation of the rotating line at Ti then done.

PARTNERS