My customer makes discs for machines. The discs come in 4 diameters. On top of the discs my customer puts rectangles. He wants to show and display all of the possible rectangles based on the diameter of the disc.
For example, a disc is 5cm in diameter. You can't put a 5cm by 1cm rectangle on the disc because the corners would be overhanging the disc (in blue on the image). You can put a rectangle that is 4.5cm by 1cm on the disc (in yellow on the image).
Does anybody have a suggestion on how best to go about achieving this? There's no cost variation. Just dimensions (height by width, diameter). It's basic trigonometry (a2+b2=c2) but trying to get this into Woocommerce isn't obvious!
Related
I am using Yfiles to to show the overview of the large Graph on the top left of the window. If the Graph is too big it is being cropped from the bottom in the overview div element. Any suggestions how we prevent the cropping of large graph from the overview component.
This indicates that either your content rectangle is not up to date (the overview always uses the contentRect to determine the bounds of the visible region in the overview), or your graph is that large that the minimumZoom property prevents the overview from not showing all contents: The default value is 0.0001, the enforced minimum 0.0000001, so you can try smaller values if your graph is really millions of units wide/high.
I would like to create an sunburst effect as in the attached image. I want the flare to be from bigger to smaller (top to bottom)Click here for image. I can get the vice versa effect but i wanted something like in this image Click here for sample image. Please guide me how to create it. Thanks in advanced.
Make a star with a 0 inner diameter and as many points as you want
"bursts".
Put a rectangle over the star but not past the points of
the star.
Select them both and click divide in the pathfinder
pallet.
Ungroup the resulting paths.
Select every other triangle and delete it.
yay!!! sunburst.
By default, y-axis in a Qt Window is increasing from top to bottom. How can i convert it from bottom to top of the window. I have seen a solution in Qt Widget application, but how can we do it in a QML project.Here QWindow is the root of the application.
In OpenGL, the y axis is increasing from bottom to top, but in Qt it is in reverse style. Why it is like that ?
Regards
Ansif
Qt has zero at the top because that's the way Window, OSX, Linux etc all define screen coordinates for 2D graphics.
OpenGL is more often used for 3D graphics, which usually defines the direction of up (y axis) as being positive, as it's easier to imagine 3D space this way with respect to objects and their positions.
Other than convention, there's no real reason for one way or the other. In fact, in 3D the y axis doesn't necessarily have to be oriented to up and down, though it usually is.
To switch directions on the screen, to place zero at the bottom and have an increasing y axis up the screen, subtract each coordinate from the full screen height.
Hello guys
I have a small problem while designing a iphone game with a grid using cocos2d.
The game needs a 10x10 grid in the middle of the screen (it is not covering the entire screen).
A line is drawn at runtime where the user touches two points in the grid.
Question: would tilemap be ideal for this problem? As i need to verify the co-ordinates do belong to the grid or not when the user touches a point would tilemap be useful?
Question: Is there any better way of solving this in cocos2d. Please help me out.
Thanks
I wouldn't recommend using tilemap for this. Personally I'd do it all with math.
Lets for arguments sake say your grid squares are 10px by 10px.
You now instantly know the positions of the rects for each square.
top right square would be (90, 0, 10, 10), this obviously doesn't include the positioning of your grid, but you can easily add that onto this by adding.. (90+gridPos.x, 0+gridPos.y, 10, 10).
Then you just check your touches intersect the rects of the grids.
Drawing a line is fairly simple, i imagine you'd draw it from the center of the 2 grid points.
So if the line started in the top right grid square it's initial point would start at (90+gridPos.x, 0+gridPos.y, 5, 5), or (90+gridPos.x, 0+gridPos.y, gridSquareHeight/2, gridSquareWidth/2)
Using cocos2d it's pretty easy to also make every square a touchable sprite, that can react when touched however you like, sending a message back to a delegate or even just doing a visual effect.
There are tonnes of possibilities for solving this problem.
I have a rectangle of any arbitrary width and height. I know X,Y, width, and height. How do I solve the upper right hand coordinates when the rectangle is rotated N degrees? I realized if it were axis aligned I would simply solve for (x,y+width). Unforunatly this doesn't hold true when I apply a transform matrix on the rectangle to rotate it around its center.
It's usually easiest and fastest to let Flash's display code do these kinds of things for you. Create an empty Sprite and put it inside the rectangle's display object at the corner you want to track. Then, find the location of that sprite in the coordinate space of your choice:
var p:Point = new Point(0,0);
myRectangle.myCornerSprite.localToGlobal( p );
someDisplayObject.globalToLocal( p ); // for a coord space besides the stage
This gets you out of making any assumptions about the rectangle's design (i.e. registration point), and works even if the rectangle should be skewed or scaled as well as being rotated. Plus, this will be much easier to implement and maintain then a mess of cosines and whatnot.
(Note that the code above assumes that "upper right" refers to a specific corner - if you want to examine whichever corner happens to upper-rightmost at the moment, I'd simply add do the same thing with a sprite at all four corners, and pick whichever is to the upper right in global coords.)
You just have to calculate the point on a circle for the given radius. The center of your rectangle will be the circle's origin and any corner will be a point on the circle's circumference. You need to use trigonometry to calculate the new point using the rotation. I don't have time right now to explain all this, but here is a link to a decent 2D Javascript library I've used in the past and which should give you everything you need (bearing in mind that the math is virtually the same in Javascript and ActionScript) to work it out for yourself.
http://jsdraw2d.jsfiction.com/viewsourcecode.htm