Jump to content

  • Log In with Google      Sign In   
  • Create Account

A Rubic's Cube Type Problem !


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 Poigahn   Crossbones+   -  Reputation: 520

Like
0Likes
Like

Posted 01 January 2013 - 09:18 AM

Let me start by saying I searched the Vintage post for This topic, and did not find anything Useful.

 

1 - Has anyone solved the rotations of the Rubic's Cube, other than "Peeling of the color squares and re-applaying them" ?

    Doing That has me wondering, since I can not find in any of my books on 3D graphics. 

    How do I applay a texture to ONLY 1 Side of a Cube ?

2 - I can Apply 6 different colors to the cube ( 1 on each side via a UVMapper software and then creating a Skin Texture )

     But since I want to apply an Image to this Cube, when the Cube is rotated, Peices of the Image are also Rotated, rendering them Upside down.

    I want the images to remain upright so how do I Manipulate the image only on 1 side of the cube ?

 

I hope I worded this correctly .  Basically, I want to know how to take 6 different images and apply each image to the appropriate side of my Cube?


Your Brain contains the Best Program Ever Written : Manage Your Data Wisely !!


Sponsor:

#2 Morphex   Members   -  Reputation: 298

Like
1Likes
Like

Posted 01 January 2013 - 09:36 AM

Why not render 3 * 3 * 3 Cubes with solid colors? and rotating them ? Wouldnt it be easier?


Also there are a hell of algoritms to sucessfully solve the rubik cube, searching google throws a hell of results.

Edited by Morphex, 01 January 2013 - 09:37 AM.

Check out my new blog: Morphexe 


#3 NewDisplayName   Members   -  Reputation: 359

Like
1Likes
Like

Posted 01 January 2013 - 11:38 AM

I believe his actual query is not about algorithms to solve the Rubic's cube, but how to keep the colours of the mini-squares on the surface intact while rotations.

I think, peeling and re-applying is the best option from rendering complexity perspective.

Basically, it's easier to shade subsequent colour changes for the mini quares on each cube solving step, for very obvious reasons.



#4 Poigahn   Crossbones+   -  Reputation: 520

Like
0Likes
Like

Posted 01 January 2013 - 11:39 AM

I am Not Trying to Solve Rubic's Cube -  The Problem I am trying to solve involves the graphics. The solution I have is a 6 x 3 x 3 ( 6 sides x 3 rows x 3 coloumns) each cube can only be attached to a single pivot point , so you can only rotate on only 1 of the X - Y - Z axis.  This I can control, and effectively display and rotate a Rubic's Type Cube.

  What a want my Cube to do is display a 6 Photo graphs ( 1 on each side of the Cube, sub-divided into the 3 x 3 cubes, Spin it like a Rubics Cube, and Keep the divided photo Up right on the spin, so that when the entire cube is turned to view the backside the individual photo pieces are all up-right.

  Right now any "Twist" Renders the peices upside on the backside of the Cube.

  I need to effectively, only remove or spin the upside images on only 1 side of a 6 sided sub cube.  It may help to visualize this by taking an Actual Rubics Cube, attach Numbers to the individual cubes and spin it vertically once and the look at the backside of the rubics cube to see what I mean.


Your Brain contains the Best Program Ever Written : Manage Your Data Wisely !!


#5 Geometrian   Crossbones+   -  Reputation: 1601

Like
1Likes
Like

Posted 01 January 2013 - 06:01 PM

Also there are a hell of algoritms to sucessfully solve the rubik cube, searching google throws a hell of results.

Indeed. Searching "rubik's cube" gives 7.89 megagoogles.


And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.

#6 Bacterius   Crossbones+   -  Reputation: 9281

Like
0Likes
Like

Posted 01 January 2013 - 10:15 PM

Why not render 3 * 3 * 3 Cubes with solid colors? and rotating them ? Wouldnt it be easier?

 

Well, that would be 3 * 3 * 3 - 1 cubes, since the center one doesn't exist smile.png but I think that approach makes more sense than trying to paint entire faces in one shot.


The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#7 MarkS   Prime Members   -  Reputation: 887

Like
0Likes
Like

Posted 02 January 2013 - 12:16 AM

Number all of the faces of an actual Rubik's Cube, like you suggested. Look at a single side. Let's say you are looking down the z axis. If you rotate the three slices perpendicular to the y (up) axis, the numbers on the face you were looking at will maintain their orientation. However, if you rotate the three slices perpendicular to the x (side) axis, you'll find that the number's orientations will, in fact, flip. Even when you rotate the slices perpendicular to the y axis, the orientation of the numbers on the faces at the top and bottom of the cube, relative to your view position, will change.

This is correct. Why do you expect a different result?

Edited by MarkS, 02 January 2013 - 12:23 AM.


#8 Poigahn   Crossbones+   -  Reputation: 520

Like
0Likes
Like

Posted 02 January 2013 - 09:44 AM

Either I am Not Explaining what I am Trying to do correctly or most of you are not understanding (Except NewDisplyName)

1 - I am NOT having a problem with Displaying a 3x3 cube Grid,  No Problem Rotating it. 

2 - I understand than when rows or columns are rotating that certain positions will be upside down or sideways ( This not a Problem with solid colors )

 

  I am currently Using 26 different skins, ( Generated Internally ) to display 6 different Pictures, Sub-divided by the 9 cubes on each side.

 I am not having a problem when the cube is twisted of keeping track on what Part a any picture is at any time.

My problem is a Pshycological Visualization of the Picture Puzzle when the Picture is upside down. ( players cannot visualize where that piece would go )

 

My problem is how would I twist the "1" side that is not upright, without twisting the whole sub-cube.and Re-skinning. ( Twisting the whole sub-cube throws the picture Pieces off track.

 

Maybe this just can't be done.


Your Brain contains the Best Program Ever Written : Manage Your Data Wisely !!


#9 Morphex   Members   -  Reputation: 298

Like
0Likes
Like

Posted 02 January 2013 - 10:20 AM

I think I get what you mean,you want to "roatate" the face of the cube to always display the picture in the correct direction correct? The way I am seeing is changing the UV coordinates that you have attribute to Flip the texture i the correct direction, so if you flip the cube it will ways face the correct direction is this what you want?

 

Otherwise I am not getting what you mean.


Check out my new blog: Morphexe 


#10 Poigahn   Crossbones+   -  Reputation: 520

Like
0Likes
Like

Posted 02 January 2013 - 04:32 PM

That is correct Morphex.  I don't know how to lift the image off a Texture Skin from a UV-Map or how to access the Co-Ordinates.  It may be simple once I know how, But since I am Just getting into 3D Graphics I am Lost at this point.

  Essentially I just Need to Re-Orintate 1 of 6 images to display it upright.  Can you help ?


Your Brain contains the Best Program Ever Written : Manage Your Data Wisely !!


#11 SiCrane   Moderators   -  Reputation: 9669

Like
0Likes
Like

Posted 03 January 2013 - 12:18 PM

This is how I did it: logically, the cube consists of six faces, each with nine pieces. Each face has a base orientation such that if you have a solved cube and the cube is rotated by that base orientation, you are looking at that face with the texture oriented right side up. From this view, you have four adjacent faces, each of which are called the North, East, South or West neighbor. To minimize special cases, I chose the orientations in such a way that every face is it's northern neighbor's eastern neighbor. This created a (non-unique) face adjacency table of:
  const int face_adjacency[6][4] = {
    { 1, 2, 4, 3 },
    { 2, 0, 3, 5 },
    { 0, 1, 5, 4 },
    { 4, 5, 1, 0 },
    { 5, 3, 0, 2 },
    { 3, 4, 2, 1 }
  };

Every piece has three pieces of information: which face it's texture was originally on, which part of the texture it is (upper left, upper center, upper right, etc.) and what the current orientation is. Originally each piece has an orientation I called North. Now if you take this face and rotate it right (clockwise) ninety degrees, then the upper right piece will now have the texture the upper left piece had, but it's orientation is now East rather than North. Similarly, the upper center piece now has the texture of the middle right piece, but is also oriented East rather than North, and the center just changes orientation. Basically there are two cycles of pieces that need to be swapped: UR, UL, LL, LR and UC, MR, LC, ML. With an assigned enum values of North = 0, East = 1, South = 2 and West = 3, it means that each of these right rotations needs to increment facing by 1 (mod 4).

However, rotation also requires swapping the piece information for the adjacent pieces on the adjacent faces. There are three cycles to be considered here: N.UR, E.UL, S.LR, W.LL; N.MR, E.UC, S.LC, W.ML and N.LR, E.UR, S.LL, and W.UL. (Where N.UR is the adjacent face on the north's upper right piece, etc.) Like the previous rotations, these also require a facing change, though it's not quite as simple as adding one. Moving from the west face to the north face adds 2, from the south face to the west face adds 1, from the east face to the south face adds 2 and from the north face to the east face adds 3 (all mod 4).

From here rendering each piece is a matter of taking the texture coordinates associated the piece's texture part (upper left, upper center, etc.) and offsetting them according the the orientation. If the piece's orientation is north, then the first texture coordinate should go with the first vertex, second texture coordinate with the second vertex, and so on. If the piece's orientation is east, then the first vertex should go with the second texture coordinate, and so on. Basically add the orientation value and take the modulus by four. (It might be subtract the orientation value depending if you're using clockwise or counter-clockwise winding.)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS