Results 1 to 9 of 9
Thread: Creating a cylinder object
- 07-25-2010, 06:23 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 8
- Rep Power
- 0
Creating a cylinder object
Hello,
For a class project I need to create a cylinder objects which can be manipulated. I need to manipulates the cylinder parameters because it needs to be gradually transformed to square shaped object.
Does anybody have any idea how should I do it? Currently, I cannot think about anything because I am new to java graphics. It is very urgent that I should finish the whole script in a week.
Thanks to anyone who considers my post.
-
Your question is not clear to me because I'm not sure how a cylinder, a 3D structure, can be transformed into a square, a 2D structure, nor do you tell us specifically what you don't understand. For general questions/problems such as "I cannot think about anything because I am new to java graphics" about all we can do is refer you to the Sun/Oracle Swing and Graphics tutorials. If on the other hand you state, "I tried this code ...., but got .... result when I wanted ... result" then we can help you more.
I advise you to keep your urgency to yourself. It is after all your urgency, not ours, and your question, while important, is no more important than any other question in this forum.It is very urgent that I should finish the whole script in a week.
Much luck.
- 07-25-2010, 07:41 PM #3
Member
- Join Date
- Dec 2009
- Posts
- 8
- Rep Power
- 0
When I said it is urgent, I did not mean to ignore other people's question and focus on mine. I just tried to mention how important it is for me to find a reply to my thread. By the way, I'm not a native English speaker so maybe the word urgent was not the suitable one to describe my situation.
You shouldn't waste your valuable time with replying to quotes for my unimportant threads.
- 07-25-2010, 07:51 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,406
- Blog Entries
- 7
- Rep Power
- 17
Too much modesty all of a sudden ... perhaps you meant to transform a cyclinder to a cube; if that is so all you have to do is transform a circle (the base of the cylinder) to a square and adjust the height of the cylinder if needed. So basically you have to transform a circle to a square.
kind regards,
Jos
- 07-25-2010, 08:00 PM #5
Member
- Join Date
- Dec 2009
- Posts
- 8
- Rep Power
- 0
Dear Jos,
Thank you for the reply.
I could draw a 2D square and circle with fillrect, and filloval function. But in my script, I need a gradual transforming between rectangular and circle. Is this possible with using basic java methods or do I have to create a method myself?
- 07-25-2010, 08:11 PM #6
Member
- Join Date
- Dec 2009
- Posts
- 8
- Rep Power
- 0
Anyway, thanks for the criticism, this was my first post on a forum, next time I will try to be more clear and specific.
Best,
Begum
- 07-25-2010, 08:28 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,406
- Blog Entries
- 7
- Rep Power
- 17
There is no built-in method that does it all for you, you have to write your own method for that but it isn't too difficult. If you want to transform a circle to a square you have to define some points (x,y) on the circle that gradually have to move to points (x',y') on a square. A bit of math shows you how to do it.
kind regards,
Jos
-
I'm trying to figure out the math but it seems more than trivial to me, probably I'm over-thinking it...
But I see a Taylor series expansion of a hemisphere and another one for a hemi-rectangle, and multiply each series respectively by coefficients A and B such that A + B = 1, and A starts at 1 and goes to 0 as B starts at 0 and goes to 1,.... Yikes!
- 07-25-2010, 08:43 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,406
- Blog Entries
- 7
- Rep Power
- 17
Nah, think of the first octant of a circle; points on that octant need to be moved to a straight line (the first 'octant' of the square). take the difference (x,y) of a point on the circle and a point (x',y') on the square and gradually (linearly) move (x,y) towards (x',y') in a fixed number of steps. It's too bad I can't sketch here ;-)
kind regards,
Jos
Similar Threads
-
java app - volume of cylinder
By tomwaits4noman in forum Java AppletsReplies: 1Last Post: 02-27-2010, 05:12 PM -
Morph Cone to Cylinder!
By aRTx in forum Advanced JavaReplies: 2Last Post: 05-09-2009, 05:50 PM -
Cylinder
By Manikyr in forum New To JavaReplies: 1Last Post: 02-28-2009, 03:58 PM -
Creating an object and getting a value from it
By BrownBread in forum New To JavaReplies: 2Last Post: 11-30-2008, 06:08 AM -
Creating object of Type Object class
By venkatv in forum New To JavaReplies: 3Last Post: 07-17-2007, 03:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks