• Create Account

# xissburg

Member Since 30 Apr 2005
Offline Last Active Nov 07 2012 12:52 PM

### In Topic: After collision car greatly jumps [ video ]

01 November 2012 - 06:10 AM

Well, the front of the car is hitting the floor so it should received a great impulse, but it looks like your is kinda light and consequently has a low moment of inertia. You could try to edit the collision shape to have a higher front, just to get rid of that undesired effect.

### In Topic: Intersection Between 2D Ray and Rectangle Borders

21 October 2012 - 09:22 AM

You could use the tangent of the angle of the dir vector. Depending on the direction it is pointing, you use a different formula based on the angle of the diagonal of the AABB. I've came up with this:

[source lang="cpp"]// WARNING: Untested codePoint Intersect(Point min, Point max, float alpha) // alpha is the dir vector angle{ float beta = atan2(max.y - min.y, max.x - min.x); // AABB diagonal angle float hw = (max.x - min.x)*0.5; // AABB width/2 float hh = (max.y - min.y)*0.5; // AABB height/2 float tanAlpha = tan(alpha); if (fabsf(alpha) < beta) // right section return Point(max.x, min.y + hh + tanAlpha*hw); else if (fabsf(PI - alpha) < beta) // left section return Point(min.x, min.y + hh - tanAlpha*hw); else if (fabsf(PI*0.5 - alpha) < PI*0.5 - beta) // top section return Point(min.x + hw + 1.f/tanAlpha*hh, max.y); else if (fabsf(1.5f*PI - alpha) < PI*0.5 - beta) // bottom section return Point(min.x + hw - 1.f/tanAlpha*hh, min.y); else // should not happen o_ O return WTF;}[/source]

### In Topic: [Answered] Matrix create from XYZ rotation: scale problem

06 October 2012 - 09:16 PM

Ouch. You better create a simple rotation matrix for each axis and multiply(compose) all three to obtain the final rotation matrix.

### In Topic: Fitting a plane to a 3d point set

14 June 2010 - 01:29 AM

Least Square Method

### In Topic: Inheritance and iterators

29 April 2010 - 07:13 AM

It is calling Shape::area because o object slicing. Try using pointers instead:

`for(std::vector<Shape*>::iterator it = shapes.begin(); it != shapes.end(); it++){   Shape *s = *it;      s->area();}`

PARTNERS