Archive: How to make a sentered cube


5th October 2004 14:13 UTC

How to make a sentered cube
Can somebody tell me how to make a sentered cube? Something like this ->

http://www.nylands.org/~eneo/upload/uploads/cube.JPG

Thanks


5th October 2004 16:08 UTC

link not working


5th October 2004 16:17 UTC

It's working, but it's not a cube, it's just a square...


5th October 2004 21:39 UTC

I just ranted in that mysterious_w thread about noobs so I'm feeling generous...

init:
n=5;
size=0.5; //how big is the square (0-1)
frame:
point=0;
pixel:
point=point+1;
x=-equal(point,0)+equal(point,1)+equal(point,2)-equal(point,3);
y=equal(point,0)+equal(point,1)-equal(point,2)-equal(point,3);
x=x*size;
y=y*size;

there are slightly more efficient ways but this is more readable so please dont post petty optimisations.


6th October 2004 02:03 UTC

Yea a square, I'm sorry. Not a cube.

Thanks


6th October 2004 16:49 UTC

re-looking at it that code is wrong, sorry, you need to put the point=point+1; at the end of the pixel box


6th October 2004 18:22 UTC

also working is
init:
n=5;
frame:
asp=h/w;
point:
r=i*$pi*2+$pi/4;d=0.5;
x=sin(r)*d*asp;y=cos(r)*d;


d=0.5 //this is the size of the cube
asp=h/w; // aspectratio correction


6th October 2004 21:11 UTC

hmm, I guess, except thats pretty ugly and inefficient.


6th October 2004 22:33 UTC

Point per point is the way to go. PAK got it.

There is another way to write it out, but thats not that big of a deal because it wouldn't make any noticible differenece in the preset.


7th October 2004 09:46 UTC

There is a way for making a square if you want to use more than 5 numpoints. (vibration anyone?)

Init
n=500
(or whatever numpoint value you wish for)

Per Pixel
r=i*$pi*2 ; size=0.5 ;
xa=asin(sin(r))*size ;
ya=asin(cos(r))*size ;
x=xa+ya ;
y=xa-ya ;

Now to make it vibrate on music, you can for example do:

size=0.5+v*0.2


7th October 2004 10:24 UTC

--- oops.. montana has mentioned it already, sorry---

That's cool! Thanks for the tip!
Correct me if i'm wrong: if you want to make it a real square and independent from screensize you have to change:

FRAME:
fixsize=h/w

PIXEL:
x=(xa+ya)*fixsize

should work with circles and else too.


7th October 2004 17:12 UTC

Originally posted by Tuggummi
There is a way for making a square if you want to use more than 5 numpoints. (vibration anyone?)

Init
n=500
(or whatever numpoint value you wish for)

Per Pixel
r=i*$pi*2 ; size=0.5 ;
xa=asin(sin(r))*size ;
ya=asin(cos(r))*size ;
x=xa+ya ;
y=xa-ya ;

Now to make it vibrate on music, you can for example do:

size=0.5+v*0.2
Mmmmm, 1000 asines and 1000 sines for a square

7th October 2004 17:51 UTC

But if i use montana's or your code, my scope is just build out of 2 horizontal and 2 vertical lines that can react as a whole to the music. In Tug's example the scope consists out of 500 points that can vibrate independent, isn't it?


10th October 2004 02:04 UTC

Yup, it does "cost" a lot (atleast according to these über benchmarkers...), but it can be sometimes more useful than the fast simple way.


10th October 2004 08:33 UTC

Only if you want shifting colors or sounds vibrating sounds or something fancier. There is still a fasterer way to do it point-per-point wise by using custom counters to move the points along the sides, then switching from side to side after a certain amount of points


10th October 2004 14:47 UTC

Or if you want to use Texer II, don't forget about that.

[edit]
And btw. never ever say "only if...", because as soon as you say that someone already makes up another use for it you never even thought of.
[/edit]


10th October 2004 19:09 UTC

Originally posted by S-uper_T-oast
Only if you want shifting colors or sounds vibrating sounds or something fancier. There is still a fasterer way to do it point-per-point wise by using custom counters to move the points along the sides, then switching from side to side after a certain amount of points
Thats a better way to do it than Tugs way, because your just doing a series of additions and a few 'ifs' rather than nasty trig. I'd post code but I cant be bothered.

People overuse trig functions in AVS, they seem like a universal solution to any problem when you start coding AVS but you get better control over your preset replicating the effect with your own code. Plus trig is expensive, especially in the pixel box.

10th October 2004 23:31 UTC

Never understimate the power of the dark side my son...
The sin()lords will get their revenge! buahahah!!!


11th October 2004 02:03 UTC

How many hours did you spend thinking that one up


11th October 2004 10:53 UTC

Actually it just came to me in a vision, like all my PWNing presets that use lots and lots of sin's and cos's! :blah:


15th October 2004 15:07 UTC

Originally posted by PAK-9
How many hours did you spend thinking that one up
didn't you know?
Tugg has slaved thousands of monkeys and made them type random code, eventually they *will* code best preset.

16th October 2004 01:21 UTC

Originally posted by Jaak
didn't you know?
Tugg has slaved thousands of monkeys and made them type random code, eventually they *will* code best preset.
Best preset? I thought thats how tugg came up with all his code. It's all in the PAK film "PAK-9 AVS 4 SE in outer space!"...

Tugg, or 'space monster #3' wants to code the most amazing presets so he can rule the solar system and enslave mankind; but space monsters can't code so he travels to Earth and steals all the monkeys and takes them back to his secret base on Europa. Synth-C (Ambassador Middleton) sends Nemo (Captain 'Orange' Johnson) to find and return the monkeys but he is killed when the evil Vanish (Galgamaar) lures him into a white hole by creating an irrisistable siren song of swirling colour and stellar music response by making a sun go supernova inside it. Mysterious_w (Ensign McSpacey) launches an escape pod before the ship explodes and heads for Euoropa to return the monkeys.

Meanwhile tugg is churning out great presets and slowly controlling mankind with his hypnotic colours and technical presets with bizzare I-can't-believe-this-works code (most of the stuff in Extra Dimension). Back on Earth Synth-C see's that nemo has failed and comissions montana (Dr. botchy adams) to create a computer virus to beam to tuggs evil headquarters and blow it up, so that at least mankind will not be controlled by the mad space monster. The virus is beamed out, and earth waits for the signal to arrive and destroy evil HQ.

Back in space, mysterious_w has kept ahead of vanish and arrives on Europa, racing to the HQ to grab the monkeys. He messages earth saying he has almost finished his mission, when he learns of the virus heading for the planet! So with vanish chasing behind him he throws open the doors of the HQ and races to the monkey room. Bursting in he finds a shocking sight, earths monkeys typing away on a million computers (and about a thousand monkeys flinging poo because AVS crashed on them again). He pushes the button to release them from their shackles and shouts 'follow me to the ship!' But as he runs for the door, vanish looms above him dribbling saliva and foaming with rage. mysterious_w thinks its all over, when all of a sudden vanish simply steps over him! mysterious_w turns to see tugg in all his monstrous glory thundering through the monkey room toward him.

"My Monkeys!" Tugg booms, "You will pay!"
"Not so fast" Vanish spits "With these monkeys gone, I, VANISH can control the earth, your days of weird experimenting code are OVER"
Tugg roars a deafening scream... "NEVVVEEEERRR!" And the two mighty AVS artists grab each other with the force of a thousand superscopes. mysterious_w sees his chance, running for his ship with all his might he hurries the monkeys into the tiny cargo hold of the escape pod, they barely fit, but it will have to do. From the evil HQ 200 ft away, murderous screams and thunderous blows echo, the ground shakes and ripples with shock. mysterious_w blasts into the sky and races from the planet as the virus ploughs into the HQ and triggers the explosion. For a moment all is white, then the raging heat of a thousand suns, concentrated to a single point expands to an explosive ball of nuclear energy. The escape pod blasts out of the smoke and flames, as the planet tears itself apart from the power of the nuclear inferno. The battered ship chuggs on, its weary warrior pilot picks up the transmitter and places it to his lips.

"This is Ensign McSpacey... I'm coming home"

The End

*cough* yea I really didnt have anything better to do than write that.

16th October 2004 15:33 UTC

Originally posted by PAK-9
How many hours did you spend thinking that one up
*cough* :)

It's funny though... (just a bit offtopic)

16th October 2004 17:47 UTC

hahahahahahah

Great Story PAK-9 :D

Maybe someone ought to produce a AVS-Movie from that script ;)


18th October 2004 09:23 UTC

Originally posted by Tuggummi
hahahahahahah

Great Story PAK-9 :D

Maybe someone ought to produce a AVS-Movie from that script ;)
I told you its called a PAK-Film tm (R)not an "AVS-Movie"

18th October 2004 15:30 UTC

Oh go fudge yourself.


20th October 2004 05:55 UTC

But but.... how does the Man with Newspaper fit into all this?


21st October 2004 17:17 UTC

Well when Ambassador Middleton is talking to Captain 'Orange' Johnson about how much emergency jam to load onto the ship, there is a guy sitting just in view of the camera behind the crates of jam on the left. Man with newspaper is just behind him... reading a newspaper. And if you read carefully (you need to put your face really close to the screen) the headline on the front says "Wittens Arrested in Zebra Raid"... Just one of over three hundred zebra references crammed into the film.