Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 27 Oct 2011
Offline Last Active Oct 05 2013 04:39 AM

Posts I've Made

In Topic: Circle vs Line Segment collision

03 October 2013 - 06:35 AM

Ahh gotcha! So it looks like to me your value of outT is the same as my data.Ratio in this method:
        public static CollisionData CircleVSLine(Vector2 position, float radius, VectorX displacement, LineSegment line)
            CollisionData data = new CollisionData();
            Vector2 line_to_circle;
            VectorX line_vector = new VectorX(line.Size);
            Vector2 n = line_vector.Normal;
            //Shortest distance from circle's center to line - before vector is applied 
            line_to_circle = line.Position1 - position;
            float d1 = Math.Abs(VectorX.DotProduct(line_to_circle, n));
            //After vector is applied
            line_to_circle = line.Position1 - position - displacement.Components;
            float d2 = Math.Abs(VectorX.DotProduct(line_to_circle, n));
            data.Ratio = (radius - d1) / (d2 - d1);
            if (Math.Abs(d2) < radius)
                data.Collides = true;
                data.CollisionPoint = position + (displacement * data.Ratio);
            return data;
The math looks to be very much similar, but it looks to me like you're applying some sort of coefficient (I'm guessing Sign() returns either -1 or 1?) based on the sign of the distance, where I'm just storing the absolute value of the distance. Will I be safe continuing to do it that way?

In Topic: Circle vs Line Segment collision

02 October 2013 - 06:29 PM

Thanks for the great replies! I0k0, your function is the only one doing a sweep test, which was my goal. I have a couple questions on some of your values.


d - Is this the diameter of the circle?

outT - I have no idea what this is, can you explain?

Saturate() - I've read that saturation arithmetic constrains the result of any mathematical operation to a range of values. Is this what you're doing? If so, what are you constraining the values to? 0-1?

In Topic: Cartoony borders - need help

28 September 2013 - 03:01 PM

I think what he means is lines that vary in thickness along the course of the line. This is actually a side effect of the way these lines are drawn in the first place; with a pen tablet. Photoshop tools allow you to vary the thickness of the lines drawn depending on how hard you press down on the tablet (from what I understand, I've never used one).


That being said, you could probably fake this effect using the Pen tool in Photoshop if you wanted to badly enough.

In Topic: Intersection Point of two Vectors

14 September 2013 - 02:58 PM

To be clear guys, the implementation I used above works, I'm just curious about how it works. Specifically the prep product. Are there any governing theorems that explain this property of prep products?

In Topic: Intersection Point of two Vectors

14 September 2013 - 04:11 AM

Alright, so bear with me; I have a lot of knowledge gaps to fill in. Solving it algebraically like you set it up, I see there being two unknowns, t1 and t2, right?

p1 = (2,5)
p2 = (1,1)
d1 = (4,-5)
d2 = (6,1)

p1 + t1 * d1 = p2 + t2 * d2


So, plugging in the x values only, and solving for t1:


4t1 + 2  = 6t2 + 1

4t1 = 6t2 -1

t1 = 3/2t2 - 1/4 


I still need to get the value of either tor t2 to go any further, don't I?