Finding if 2 squares are sharing a side [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Im wondering how could i find if 2 square share a same side.
i have 2 information:
position and size
position is the left up corner of the square
+---+---+
| s |
| s |
+---+---+
here s is the shared side of both square

Since you lack "orientation" as a datum, we will assume that they are orthogonal to the axes. At this point it becomes a matter of checking if either of the horizontal or vertical edges are collinear (which is trivial since you don't need to worry about orientation), and then seeing if either corner falls within the other square's side or vice versa.

Related

Find the boundary of a polygon (or a staircase) c++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I'm doing an 2D bin packing algorithm. The goal is to put a set of rectangle into a bin one by one.
At each rectangle insertion, i want to update the boundary between occupied area and free area. Thus, i'm looking for an algorithm or the way to do it. Algorithm must be able to:
1) Find the boundary after rectangle insertion (or find all points of the boundary).
2) Travel clockwise all the points of the boundary (imagine that now I have all points coordinates of the boundary).
3) At each corner (point) of the boundary, the algorithm can determinate if this point is on the top left, top right, bottom left, bottom right
Any help would be greatly appreciated. If you need more information, just ask and I'll provide all I can.
Thank you
See these links:
http://en.wikipedia.org/wiki/Bin_packing_problem
How is 2D bin packing achieved programmatically?
https://math.stackexchange.com/questions/352575/2d-bin-packing-problem-with-opportunity-to-optimize-the-size-of-the-bin

Calling 2 functions in an alternating manner in display function [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have a function that simply constructs a stick figure in 1 position
I have another function that builds a stick figure in another position.
I now want to call these functions alternatively so that the figure will appear to walk.
I'm not sure if I have to push and pop matrices.
For such rudimentary animation, will a boolean flag not do? (OpenGL doesn't even come into it here, it's merely logic)
I.e. in your draw method:
animate = !animate; // flip flag for 2 possible frames (boolean member variable)
if (animate) {
// draw position 1
} else {
// draw position 2
}
However, bear in mind this is just some quick sample code to get the idea across - it would result in every frame having the animation occur, which would likely occur so fast to be nauseating. You will have to apply time logic to it as well to make the simple animation not just appear as a blur.

How can i render a tiled map with C++/SDL [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I want to render tiles to the screen from a text file. I have the random terrain generator working, and I can move the data from the text file to a 2d vector. What I'm having trouble with is understanding how to give those tiles the coordinates they need to be rendered at. How would I go about assigning each tile its own coordinates relative to the camera?
I suggest checking this lua tutorial on how create a tile engine in great detail. You'll learn much more then what someone will be willing to post here on stack. Tile Engines as you will see from this tutorial, requires more then just a few lines of code. After you learn it here, it shouldn't be to hard for you to translate it to sdl/c++. Just a thought.
Its a good starting place.

Remaking Star Fox using DirectX [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I'm trying to remake the game of Star Fox for the N64. Right at the time I'm having trouble with collisions and getting the my ship to shoot like it suppose.
The biggest challenge I'm having right now is getting the aiming box for this game
anything would help.
sorry I didn't notice that half of my question was cut off. link to source code
Right now I'm trying to get box collisions to work. Also how do you put a bounding box on a primitive like a Cylinder, Torus, ect.
also so .X files would be just as good help if you know any sites.
Sorry, without more information...

Computing Rotation Speed In C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
Basically, In C++, how do I compute how long will it take for a car wheel to rotate 360 degrees while moving at a speed of 10 MPH? I've tried googling but nothing showed up. Any ideas?
As usual, I've searched this site for an answer but nothing showed up - unless I missed one.
Thanks.
If you know the speed of your object and the radius of the circle it moves on, then the time needed for one rotation is
rotation_time = 2*pi*radius/speed
The number of rotations per time unit is
rotation_speed = 1/rotation_time
The angular speed is
angular_speed = full_circle/rotation_time,
with the value of full_circle depending on your angular unit, e.g. 360 or 2*pi.