### Author Topic: rearranging arrays  (Read 278 times)

#### SkyCharger001

• Hero Member
• Posts: 1594
##### Re: rearranging arrays
« Reply #15 on: October 25, 2012, 10:13:18 AM »
Quote from: 23452 on October 21, 2012, 04:20:11 PM
Okay maybe it would be better if say the entire problem.
I am using this in a voxel engine, so it needs to be fast.
o is a voxel and has a x, y, z, and a color value. x(o), y(o), z(o), c(o)
They are only one element arrays because I am using them like a math function.
I use x(o), y(o) and z(o) to calculate where they will be drawn on the screen. xf(o) and yf(o)
The problem is that it is drawing one object over the other based on the objects number.
I can calculate the the distance from the eye( this works like a real eye, so the eye and the screen are not at the same place) by mixing the distance formula  and Pythagorean theorem, and I need it to draw from the greatest distance to smallest.
it would remove the need to sort the elements.

#### 23452

• Jr. Member
• Posts: 72
##### Re: rearranging arrays
« Reply #16 on: October 25, 2012, 09:46:48 PM »
T_T  It is kinda sad, I solve the problem of how to translate, rotate, and dilate a pyramid made up of inequalities in about a hour, but something as simple as this has me completely confused.

#### DarthWho

• Hero Member
• Posts: 3853
• Timelord of the Sith
##### Re: rearranging arrays
« Reply #17 on: October 25, 2012, 10:07:43 PM »
You are not alone; I often get lost with the simplest of parsing tasks. the important part is that you asked the question rather than stay silent and struggle.

(side note most of my parsing tasks I do in other languages or I use prebuilt libraries to do the job)
Rassilon: My lord Doctor; My lord Master; My lord DarthWho
The Doctor and the master at the same time :WHAT!?!?!

FastMath 1.1.0 released: http://dl.dropbox.com/u/12359848/fastmath.h