473,384 Members | 1,854 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,384 software developers and data experts.

JMonkeyEngine to create a cube

I'm using JMonkeyEngine, and trying to make objects in a cube. Meaning, a three-dimensional cube out of objects (Spheres, to be specific). However, the logic is escaping me. This is what I have so far:

for(int i = 1; i<9; i++){
for(int j=1; j<9; j++){
for(int k=1; k<9;k++){
add object
}
}
}

I'm really sitting here scratching my head, cause this gives a triangle viewed from different angles to be a different triangle. It gives a sliver of a cube. I'm looking for an algorithm for a whole cube, in pseudo code or java so I can trace it out and understand how to do this.
Jun 4 '08 #1
6 2536
oh shoot, i forgot to add that the add object is at i,j,k

Duh duh = duhs.get((i*j*k)-1);
duh.setLocalTranslation(new Vector3f(i, j, k));
Jun 4 '08 #2
the actual source code i have working that gives the triangle
that canged at different angles

Node n = new Node();
for(int i = 1; i<9; i++){
for(int j=1; j<9; j++){
for(int k=1; k<9;k++){
AtomSphere atom = atoms.get((i*j*k)-1);
atom.setLocalTranslation(new Vector3f(i, j, k));
atom.setSolidColor(ColorRGBA.gray);
n.attachChild(atom);
}

}
}
Jun 4 '08 #3
JosAH
11,448 Expert 8TB
AtomSphere atom = atoms.get((i*j*k)-1);
This can't be correct; e.g. it fetches the same atom for values i,j,k == 2,3,4 and
i,j,k == 4,6,1

kind regards,

Jos
Jun 4 '08 #4
So, I'm still lost on how to traverse the cube correctly. i*j-k doesnt work right, it only works for the last square in the cube. The rest that shows up is one edge of the cube.
Jun 4 '08 #5
JosAH
11,448 Expert 8TB
So, I'm still lost on how to traverse the cube correctly. i*j-k doesnt work right, it only works for the last square in the cube. The rest that shows up is one edge of the cube.
Just guessing from the little code snippet you showed us:

Expand|Select|Wrap|Line Numbers
  1. for(int i = 0; i<9; i++){
  2.    for(int j= 0; j<9; j++){
  3.       for(int k= 0; k<9;k++){
  4.          AtomSphere atom = atoms.get(81*i+9*j+k);
  5.          ...
  6.  
This is assuming that 'atoms' is a simple list that stores all the atoms. The
three indexes i,j,k are transformed to a single linear index value.

kind regards,

Jos
Jun 5 '08 #6
BigDaddyLH
1,216 Expert 1GB
Just guessing from the little code snippet you showed us:

Expand|Select|Wrap|Line Numbers
  1. for(int i = 0; i<9; i++){
  2.    for(int j= 0; j<9; j++){
  3.       for(int k= 0; k<9;k++){
  4.          AtomSphere atom = atoms.get(81*i+9*j+k);
  5.          ...
  6.  
Or maybe (to keep arithmetic out of it...
Expand|Select|Wrap|Line Numbers
  1. int atomIndex = ???;
  2. for(int i = 0; i<9; i++){
  3.    for(int j= 0; j<9; j++){
  4.       for(int k= 0; k<9;k++){
  5.          AtomSphere atom = atoms.get(atomIndex++);
  6.          ...
  7.  
No one in this forum has stepped forward and admitted to knowing JCodeMonkey, so you need to explain things better or see if that product has its own forum.
Jun 5 '08 #7

Sign in to post your reply or Sign up for a free account.

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...
4
by: Dmitry Tkach | last post by:
Hi, everybody! I am trying to create a custom GiST index in 7.3, but getting an error, that I don't know how to interpret: testdb=# create table gist_test (field int8); CREATE TABLE testdb=#...
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: Dip | last post by:
Hello Experts, I was wondering whether it is possible to create "Cube Roles" automatically. I have a table name called tblUsers which has "ProjectID" and "EmployeeID". Employees are allocated...
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...
7
by: J-Burns | last post by:
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: 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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.