473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Rotating a cube

Hello. Need some help here. I have a 4*4 cube. So the equation of the
cube becoming:

x + 4*y + 16*z

Now i want to rotate this cube 90 degrees anticlockwise( a right
rotation). How can i do that? The rotation must take place with the
axis of rotation being the straight line through the center of the
cube and perpendicular to the "xz-plane." The axis are aligned in this
fashion:

y
|
|
|________ x
/
/
z

Moreover, also tell me how to perform a rotation with the axis of
rotation being the straight line through the center of the cube and
perpendicular to the "yz-plane."

Essentially, I need the equations of the lines after the rotation has
been done in both cases.
Is there a built in Python function for this?
Jul 17 '08 #1
7 3159
J-Burns wrote:
Is there a built in Python function for this?
for answering questions that have nothing to do with programming, and
looks quite a bit like homework? don't think they've added that one yet.

maybe you should look for a geometry newsgroup/forum?

</F>

Jul 17 '08 #2
On Jul 17, 12:53 pm, Fredrik Lundh <fred...@pythonware.comwrote:
J-Burns wrote:
Is there a built in Python function for this?

for answering questions that have nothing to do with programming, and
looks quite a bit like homework? don't think they've added that one yet.

maybe you should look for a geometry newsgroup/forum?

</F>
I meant to ask how would you do this in Python... :S
Jul 17 '08 #3
Have you taken the time to solve the problem for the 2D case?

I can't say my code is correct or even good python, but this was my
attempt at the 2D case, maybe it will give you some ideas.

http://code.google.com/p/rs-wxpython...e/rectangle.py

For the rest of c.l.p, criticism is welcome :-)

Regards,
Ryan

On Jul 17, 2:11 am, J-Burns <arslanbur...@gmail.comwrote:
On Jul 17, 12:53 pm, Fredrik Lundh <fred...@pythonware.comwrote:
J-Burns wrote:
Is there a built in Python function for this?
for answering questions that have nothing to do with programming, and
looks quite a bit like homework? don't think they've added that one yet.
maybe you should look for a geometry newsgroup/forum?
</F>

I meant to ask how would you do this in Python... :S
Jul 17 '08 #4
J-Burns wrote:
Hello. Need some help here. I have a 4*4 cube. So the equation of the
cube becoming:

x + 4*y + 16*z

Now i want to rotate this cube 90 degrees anticlockwise( a right
rotation). How can i do that? The rotation must take place with the
axis of rotation being the straight line through the center of the
cube and perpendicular to the "xz-plane." The axis are aligned in this
fashion:

y
|
|
|________ x
/
/
z

Moreover, also tell me how to perform a rotation with the axis of
rotation being the straight line through the center of the cube and
perpendicular to the "yz-plane."

Essentially, I need the equations of the lines after the rotation has
been done in both cases.
Is there a built in Python function for this?
--
http://mail.python.org/mailman/listinfo/python-list
======================================

OH-Boy!

1) a regular cube is dimensioned having three mutually perpendicular
axis, each of same length. The 4x4 would be for a plane.
2) Clockwise IS Angles Right. (Rotate to right.)
Normal Angles Right would put zero at +Y, 90 at +X as viewed from +Z.
Norman Angles Right would put zero at +Z, 90 at +Y as viewed from +X.
Normal Angles Right would put zero at +Z, 90 at -X as viewed from +Y.
(there are six faces, finish the defs for the rest.)
3) Normally all rotations are defined as pivoting about the 0,0,0 point.
To use center of a plane or other pivot point is to add offsets.
4) Sequence of rotations controls final spatial orientation.

As for finding a cube handling graphic in the standard package download,
I did not. Somebody else can answer if there is a full blown Python
vector graphic package.

At a minimum you need to define a:
rotational routine that handles N 3D points as a single bundle.
The usual routines consider each rotation as being about a single axis.
It computes all N corners each time.
translation routine that moves N 3D points as a single bundle along a
single 3D vector.
It computes all N corners each time.
scaler routine that expands/contracts the relative distances between
the N 3D points using vectors from the computed 3D center.
It computes all N corners each time.
Some pre-/post routines to put things together to get the desired effects.

If N=0 (the nothing) there is nothing to do.
If N=1 (the point) there is no rotation or scale.
If N>1 (the line,plane,box,sphere,torus,etc.) then use all three.
(a sphere can be computed as three points of an isosceles triangle in
which the third side can equal the other two. The points then are used
to create a circle (ellipse) which is rotated about the third side.
In case it isn't obvious - the perpendicular bisector of the third side
is the center of the sphere. To track a point on a sphere is simply to
use 4 points. 0,1,2 are triangle and 3 is the point. Do your thing on
all 4, use 0,1,2 to remake sphere and 3 will be right place.)

The Chemical Rubber Company's Handbook of Physics and Chemistry is a
good starting point for the equations. Johnny, George, Willie and I
also used a few Celestial Mechanics books from the Library when we wrote
those in assembly in the long ago and far away. (back in the '60s on the
other side of the continent.) Sorry, but the punch cards disappeared
long ago and access to CAD programs deletes my need to re-write them.
Steve
no******@hughes.net
Jul 17 '08 #5
Lie
On Jul 17, 3:11*pm, J-Burns <arslanbur...@gmail.comwrote:
On Jul 17, 12:53 pm, Fredrik Lundh <fred...@pythonware.comwrote:
J-Burns wrote:
Is there a built in Python function for this?
for answering questions that have nothing to do with programming, and
looks quite a bit like homework? *don't think they've added that one yet.
maybe you should look for a geometry newsgroup/forum?
</F>

I meant to ask how would you do this in Python... :S
The same as you do it in any other languages. This question is marked
correctly as having no relationship to python whatsoever. You'd get a
better answer if you asked in mathematics/geometry group, many
mathematician are adept programmer as well.
Jul 19 '08 #6
David Lyon wrote:
But is the question about display graphics ?

ie rotating a cube using a python framework ?

With something like python and OpenGL ? or Python and PovRay... or
perphaps python and imagemagick ?
can you name one graphics framework that represents a cube as "x + 4*y +
16*z" ?

</F>

Jul 20 '08 #7
Fredrik Lundh wrote:
David Lyon wrote:
>But is the question about display graphics ?

ie rotating a cube using a python framework ?

With something like python and OpenGL ? or Python and PovRay... or
perphaps python and imagemagick ?

can you name one graphics framework that represents a cube as "x + 4*y
+ 16*z" ?
no, but ...
I don't think the notation is so strange,
in electronics (and others) I'm used to a 2-dimensional complex notation:
vector = 3 + 4*i = 3*x +4*y

but although my English isn;t very well,
a "cube of 4*4" looks strange to me.

cheers,
Stef
>
</F>

--
http://mail.python.org/mailman/listinfo/python-list
Jul 20 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mrwoopey | last post by:
Hi, My OLAP data cube is giving me the following error when I am manipulating OLAP data cube views: "the data being processed is over the allowed limit" I know that this message is caused by...
3
by: Biswajit Barik | last post by:
Hi All, I want to create a cube using MSSQL2000 i dont know any thing how to create and what is parameter required so if any body help me i will be thankfull to him/her.For information : i have 4...
0
by: mrwoopey | last post by:
Hi, I am using the OLAP data cube in a web browser (using the code from the SQL 2000 toolkit). The OLAP services is on database server and the web interface is on the web server. If we do simple...
0
by: Fan Ruo Xin | last post by:
I installed Stinger in my PC (w2k). I need to do a quick compare between DB2 OLAP server and DB2 Cube Views. And I only found DB2 Cube Views version8.1 trial code from IBM website. I didn't want to...
2
by: ravindra4s | last post by:
hi...I am very new to DB2 Cube views, I worked with MS Analyis services earlier and this is new assignment for me to work with DB2 Cube views, Can I get any help regarding this..........Is DB2...
0
by: jai83 | last post by:
I have a doubt regarding alphablox-cube views. I have created a cube in the olap centre(using db2 cube view 8.1.10).I imported the cube in alphablox.But while drilling down i am not able to retrieve...
0
by: DC01 | last post by:
I have added a new measure successfully into the normal cube. I then add it to the virtual cube and reprocess all cubes. I can browse the normal cube successfully. Then when I try and browse the...
0
by: Tim | last post by:
Hi Folks, I'm not certain if this is the correct group to post this question in, if there is a more appropriate one please advise. We have a cube that takes a little time to build, length of...
1
by: AR123 | last post by:
Hi I want to set up a rotating banner. Not sure how to incorporate my rotating banner code into the code below. I want the rotating banner to be the main feature image? This is set up in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.