• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
maxxx

how to make a circle spin ?

10 posts in this topic

hi
i want to turn a circle around it's own center like a ball or car tire

so i got a 2d vector class for my object(circle) position
and i draw a circle using that


[code]Ellipse(backbufferDC,(int)objectpos.x-25 ,
(int)objectpos.y-25 ,
(int)objectpos.x+25 ,
(int)objectpos.y+25);[/code]
how can i spin my circle now ?

i've tried this :

[code]x = x*cosf(r) - y* sinf(r);
y = y*cosf(r) + x * sinf(r);[/code]

just made my circle to move around a circular path
0

Share this post


Link to post
Share on other sites
[quote name='maxxx' timestamp='1302986506' post='4799252']
hi
i want to turn a circle around it's own center like a ball or car tire

so i got a 2d vector class for my object(circle) position
and i draw a circle using that


[code]Ellipse(backbufferDC,(int)objectpos.x-25 ,
(int)objectpos.y-25 ,
(int)objectpos.x+25 ,
(int)objectpos.y+25);[/code]
how can i spin my circle now ?

i've tried this :

[code]x = x*cosf(r) - y* sinf(r);
y = y*cosf(r) + x * sinf(r);[/code]

just made my circle to move around a circular path
[/quote]

The function you use to draw circles can't handle rotations on its own and rotating a circle doesn't make much sense (it would look the same regardless of how its rotated).

If you tell us what API you are using we might be able to tell you how to rotate other things.
0

Share this post


Link to post
Share on other sites
im using win32 api
and there is going to be a line in the circle to show the rotation (i can't draw this line from the center of circle )
i know it doesn't make much sense but it's a project for school so ...
0

Share this post


Link to post
Share on other sites
Can you just draw the circle and then rotate one endpoint of the line? That is, one end point is the center point of the circle, the other end point is the point (circle_x, circle_y + radius), which you then rotate?
0

Share this post


Link to post
Share on other sites
You can't means that you aren't able to, or that doing so will not fulfill your requirements?

What kind of line will you use? Are you looking for one that spans the diameter rather than the radius?
0

Share this post


Link to post
Share on other sites
actually our teacher said we shouldn't do that cuz that way we can spin the line instead of circle

the line should be in the random place inside of circle so we can tell whether our circle is spinning around its center or not
0

Share this post


Link to post
Share on other sites
It's impossible to rotate a circle - at least in computer graphics terms where a circle is defined by its center-point and a radius. I would do the following: store your circle-with-a-line-in-it as a class, give it two vectors as members, one for its center-point and one to represent its orientation. Then when you draw this construct you draw the circle (without rotation of any kind, that doesn't make sense - use the construct's center-point vector member as the origin of the circle obviously) and then you determine a line from the center of your circle out into the direction the whole thing is pointing (using the second member vector, the orientation) and just draw a segment (a part) of that line.

[img]http://i8.photobucket.com/albums/a7/dkh2/delme.png[/img]
This is what you would get, the small red line is your orientation member vector which would not be drawn, instead the small thick black segment of it is drawn.

Hope this makes sense and helps.
1

Share this post


Link to post
Share on other sites
[quote name='dublindan' timestamp='1303012984' post='4799365']
like i said i can't draw the line from the center point of circle
[/quote]

As many have already said, it is impossible to see the visual effect of a rotating plain uniform circle and since you cannot draw a line from center point of circle, why don't you try drawing a few lines that are perpendicular to any radial line inside the circle? That would make the rotation more obvious.
1

Share this post


Link to post
Share on other sites
1. Implicit form
( x - x[sub]0[/sub] )[sup]2[/sup] + ( y - y[sub]0[/sub] )[sup]2[/sup] - R[sup]2[/sup] == 0
Each pair {x,y} that fulfills the above equation is a point on the circle centered at (x[sub]0[/sub],y[sub]0[/sub]) and with radius R. AFAIK no rotation can be expressed within.

2. Parametric form
{ x = R cos( 2pi*t+p ), y = R sin( 2pi*t+p ) } w/ t in [0,1]
where a rotation in the given space can be expressed by varying the phase p.

3. Any form is given in a space, and the space can be rotated with the circle within and with respect to the reference space.

4. The (combined) visual representation of circle and line (i.e. a bitmap) can be rotated, what could be understood as a special case of 3. (kind of rotating in "pixel space").

However, as is written several times above, the visual representation will not change besides artifacts due to sampling. Demanding that the indicator line should not be rotated by itself because it would not be a proof that the circle rotates is senseless, because line and circle are 2 distinct objects anyway. That said, what sense does it make to rotate the circle in that way? Is the exercise correctly understood?
1

Share this post


Link to post
Share on other sites
maxxx, could you give us as much information as possible? In particular, what are you studying (you say it's a project for school. Is it high school or college? what is the subject about and what have you already seen?), and the exact the text of the assignment. with as much context information as we could need. As you have put it it doesn't seems to make much sense, so probably there's some misundestanding around there :)

[b]Edit:[/b] Hmmm, if you are using, as it seems, the Windows [url="http://msdn.microsoft.com/en-us/library/dd162510%28v=vs.85%29.aspx"]Ellipse()[/url] function, you probably should draw a circle and a line into a DC and then apply the rotation with [url="http://msdn.microsoft.com/en-us/library/dd145104%28v=vs.85%29.aspx"]SetWorldTransform[/url] function.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0