Closed Thread Icon

Topic awaiting preservation: Nobody ever cracked this one.. (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8579" title="Pages that link to Topic awaiting preservation: Nobody ever cracked this one.. (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Nobody ever cracked this one.. <span class="small">(Page 1 of 1)</span>\

 
amikael
Bipolar (III) Inmate

From: övik
Insane since: Dec 2002

posted posted 03-20-2003 23:59

I dare ya on this one..
No one has ever figured out how to make the z-indexing work for this puppy.
It's found live at http://www.naltabyte.se/space
It's using a shorter calculation for 3D than would otherwise have been the case, and I understand what it does - which matters to me - so I like it, except it can't crank out a correct viewport to allow calculation of the z-index.
I'll pay a 100 dollars to anyone who solves this, and I'm kidding you not, I'm that frustrated with it.
Also, anyone that can find a shorter and more efficient way of doing the same is welcome..

[pre]
//----Code beginning----


function point(y, x, a, width, height,x2,y2)
{
/*
a is the angle.
x is the x-value.
y is the y-value.
width is the width of the area used to project the shape.
height is the height of the area, and the lower this value, the more we see the shape from the side, and the higher, the more we see it from above.
If height is equal to width, we see it directly from above.
x2 and y2 is the center of the projection.
*/

var x1=sphereCos(a,width);
var y1=sphereSin(a,height);
var z=eval(cutData(a)+"+"+90);//Creates a z-value out of the angular value.

var c=-((y*height)*(z/100))/1000;
if(height < 0){c=-((y*(-height))*(z/100))/1000;}

if(x != 0)
{
if(height >= 0){ x=x-((x/1000)+(y*(height*0.0009)));}
else { x=x-((x/9.9)+(y*(height*0.0009)));}
if(y > 0){y=y-c;}
if(y < 0){y=eval(y+"+"+c);}
x=x+(z/60);
}

/*
Here I 'project' the point in space, going out in a given direction a set number of points (x) to draw the 3D-shape point by point.
Problem is, I cant figure out a natural way of defining the viewport so that I
can calculate a z-index for it.
I figure I need to use the height/width relation to decide from which angle the object is viewed.
*/

if(x >= 0){for (j=0; j <= x; j++){p1=Math.round(x2 += x1);p2=Math.round(y2 += y1);}}
else {for (j=0; j <= -x; j++){p1=Math.round(x2 -= x1);p2=Math.round(y2 -= y1);}}

if(height >= 0){tY=(((width-height)*y)/100);z=z+(-tY)}
else {tY=(((width-(-height))*y)/100);p2=-p2;z=z+(tY)}

/*
The value is returned in a format suitable for VML-polylines.
*/

return Math.round(p1-(tY/360))+","+Math.round(p2 + tY)+" ";
}

function cutData(arg,arg2)
{
/*
Basically, it returns the angular value (arg) into integers ranging from -90 to 90
meaning that the z-value is set from the back to the front.
*/

if(arg < 0){arg=-arg;}
if(arg=="0"){arg++;}
if(!arg2){arg2=0;}
if(arg > 360){ arg=arg-360;}
if(arg > 90 && arg < 270){arg=180-arg; arg=eval(arg+"+"+arg2); return arg;}
else if(arg >= 180 && arg < 270){arg=arg-180;arg=eval(arg+"+"+arg2); arg=-arg; return arg}
else if(arg >= 270 && arg <= 360){arg=eval(arg+"+"+arg2); return arg-360;}
else return eval(arg+"+"+arg2);
}

function sphereCos(arg1,arg2){return (parseInt(Math.cos(2 * Math.PI * arg1 / 360) * arg2))/160;}
function sphereSin(arg1,arg2){return (parseInt(Math.sin(2 * Math.PI * arg1 / 360) * arg2))/160;}

//-------Code ending--------

[/pre]

(^-^)b

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 03-21-2003 00:09
quote:
Nobody ever cracked this one..

I dare ya on this one..

No one has ever figured out how to make the z-indexing work for this puppy.



Arrr, what? Maybe a name would help cause the link you posted did nothing but ask me to download and install something whenever I clicked on one of the "view sample" links and I'm not prepared to do that just to see this thing that aparently doesn't work in some way or another.

Specifics help.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 03-21-2003 00:19

Yes, yes, more information please... I couldn't figure out where it was in the link you gave, and I'd like to hear more specifics on what it's supposed to do and where a/the problem is occuring.

amikael
Bipolar (III) Inmate

From: övik
Insane since: Dec 2002

posted posted 03-21-2003 01:39

Ok, this thing requires VML and IE5x because I need the vector graphics and VML was the closest at hand.
This link takes you direct to a sample using it. http://www.naltabyte.se/space/files/deepsea2.htm

The problem is how to automatically decide the z-index for each polygon being drawn, and I know that normally you'd measure the distance between the 'camera' and the object, but in this case, the model is different, so I dont know how to resolve that.

The 'engine' uses PI/a circle as a foundation, and projects each point in space one by one, until the polygon shape is drawn, and it takes three basic parameters.
It's going out in a given angle (a) a number of points (x) and then up/down from that position (y).
By changing (a) for all points, all points are re-calculated and the whole shape is turning around without loosing structur.



(^-^)b

« BackwardsOnwards »

Show Forum Drop Down Menu