473,663 Members | 2,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JMonkeyEngine to create a cube

27 New Member
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 2548
blackraven1425
27 New Member
oh shoot, i forgot to add that the add object is at i,j,k

Duh duh = duhs.get((i*j*k )-1);
duh.setLocalTra nslation(new Vector3f(i, j, k));
Jun 4 '08 #2
blackraven1425
27 New Member
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.setLocalTr anslation(new Vector3f(i, j, k));
atom.setSolidCo lor(ColorRGBA.g ray);
n.attachChild(a tom);
}

}
}
Jun 4 '08 #3
JosAH
11,448 Recognized Expert MVP
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
blackraven1425
27 New Member
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 Recognized Expert MVP
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 Recognized Expert Top Contributor
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
2557
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 the size limit of each form field that is retrieved in the Request object is 102,399 bytes. The error occurs when I exceed this limit.
3
27915
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 tables custdetailtable which contain all about a customer as per example customer ID,name,add,CUSTOMERID IS PRIMARYKEY, Proddetail table which contain all about a product mean productcode,productname,productvalue,dman (dateof manufacture),dexp...
0
3112
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 queries on the cube, it works fine. When we do complex queries the cube in the web browser loads very slow or errors. Also, I noticed that when it is building the output for the cube (the display) that most of the processing is taking place on...
4
2731
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=# create index gist_idx on gist_test using gist (field); ERROR: data type bigint has no default operator class for access method "gist"
2
1897
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 Cube views(ROLAP MOLAP or HOLAP storage) and does MDX work with DB2 cube views?
0
1412
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 to certain projects based on their levels. Now, how do I bypass all Windows Domain Security and allocate users to the cubes based on their project ID. I know it is a common practice for
0
1523
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 virtual cube it says 'Retrieving Data' but then thats it, it just hangs like that. I am using AS2000. The other problem I have is that the data is doubling up when its in the cube. The SQL which sets up the fact tables are all fine and are...
0
1222
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 time varies by point in day and source SQL Server loading. While building the cube is 'off-line' and this is bothering the powers that be. As the underlying SQL Server data warehouse grows the time 'off-line' is bound to lengthen.
7
3181
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 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:
0
8436
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8858
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7371
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5657
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4182
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.