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
Related
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.
How can i calculate the area of a polygon in c++ only by knowing the x and y coordonates of the points which make the polygon?
A simple google search shows the answer provided that you are dealing with non-self-intersecting polygons. The sign of the area is positive if the points on the polygon are arranged in counterclockwise order. This formula does not assume that the polygon is convex.
http://mathworld.wolfram.com/PolygonArea.html
Here, the area is found by summing the determinent of neighboring points. Each determinent computes the area of the parallelogram formed by the vector e.g. (x1,y1) and (x2,y2) (where both vectors stem from the origin (0,0)). The division by 2 gives the area of a triangle. When traveling around the polygon, the triangles will have a positive area if your polygon is convex. Otherwise, negative areas of these triangles will cancel with their positive counterparts for the case of a concave polygon giving you the correct result.
Simple wikipedia search shows the answer:
http://en.wikipedia.org/wiki/Polygon#Area_and_centroid
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.
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.
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...
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.