- AVS
- cube-E question
Archive: cube-E question
MaTTFURY
7th December 2004 01:30 UTC
cube-E question
my Code for a cube is like this (and im not interested in the "quicker" ways... of doing anything ... just want to know... how can i make the cube... no rotation etc... (do i need the rotation?) well here it is:
init: n=5;
frame:drawmode=1;
linesize=2;
rot=1;
point:point=(point+1)%4;
x1=-equal(point,0)+equal(point,1)+equal(point,2)-equal(point,3);
y1=equal(point,0)+equal(point,1)-equal(point,2)-equal(point,3);
x1=x1*0.2;
y1=y1*0.2;
x=x1*cos(rot)-y1*sin(rot);
y=x1*sin(rot)+y1*cos(rot);
x = x1+0.2; y = y1+0.2; z = -0.2; //plane 1
x2 = x2-0.2; y2=y2-0.2; z= 0.2 //plane2
//plane 3
now why cant i make a cube?
NOTE:i have another "matrix" thingo you make in the pak-9's tutorial i was going to put a cube above in this...
hboy
7th December 2004 07:19 UTC
:cool:
first, i tell you some definitions. a cube is a 3 dimensional object that consists of much more points. Do you know what I am talking about, man? first, define n for this method. thats the most important. then you say you are doing no rotation.
x=x1*cos(rot)-y1*sin(rot);
y=x1*sin(rot)+y1*cos(rot);
this is rotation, just because you have "rot" variable assigned to 1, you will never see this guy rotating. but thats okay since you didn't need that did you?
Moving on with the next lines of crap. cause that is it. if you want to make a cube, simply assign points like you did with the square. you gonna need n=(amount of lines in a cube)+1, because the starting point and ending point of the drawing is the same. do a point-per point assignment to x1,y1, and also z1.
and in the end, to merge the variables back into 2D:
z2=1/(1+z1*0.5);
x=x1*z2;
y=y1*z2;
this code has no optimizations, no aspect ratios corrected, as your wish was. learn from it.
Jaak
7th December 2004 08:57 UTC
Originally posted by hboy
Moving on with the next lines of crap. cause that is it. if you want to make a cube, simply assign points like you did with the square. you gonna need n=(amount of lines in a cube)+1, because the starting point and ending point of the drawing is the same. do a point-per point assignment to x1,y1, and also z1.
no hboy, you need 16 points iirc if you want to draw it with one line. Because you have to draw some points over to have continious line.
Anyways, as i have already sayd first try to make a cube out of 6 squares (6 superscopes), simply sync the movement and rotation of scopes, and you have a wireframe cube. thats the easiest and most logical way imo (im not saying its efficient or fast)
hboy
7th December 2004 12:11 UTC
oops totally agreed Jaak, i forgot that :D and yeah it is also easier to sync 6 squares too :)
TomyLobo
8th December 2004 02:30 UTC
why 6 squares? 4 are enough :)
you can leave out 2 opposing sides without anyone noticing ;)
also, the other ones need not be full squares, 3 borders would be enough
TomyLobo
8th December 2004 02:45 UTC
here's the cube you'd have to draw (attachment)
each of these incomplete squares has another color
Xerol
8th December 2004 02:45 UTC
Actually, all you really need are two parallel squares and 4 connecting lines.
TomyLobo
8th December 2004 02:46 UTC
yes, but if you do it with the incomplete squares, you can maybe put it in one scope
Jaak
8th December 2004 05:43 UTC
Originally posted by TomyLobo
why 6 squares? 4 are enough :)
you can leave out 2 opposing sides without anyone noticing ;)
also, the other ones need not be full squares, 3 borders would be enough
ofcourse you can, but like i sayd, i wanted to keep as simple and logical as possible. :rolleyes:
MaTTFURY
8th December 2004 22:29 UTC
could you explain it better please? i am stupid! :(
hboy
9th December 2004 08:28 UTC
you know that a cube consists of 6 sides, each can be considered as squares. soo...you need 6 squares! one for every side of the cube. place them as you would place the sides of the cube, and then you get your cube, I promise :)
PAK-9
9th December 2004 17:35 UTC
There are numerous ways of doing it with one ssc, just think about it logically and do it the way that seems most natural. If you cant think of a way of doing it because its too complicated... maybe you shouldnt be doing it.
hboy
9th December 2004 20:02 UTC
Originally posted by PAK-9
There are numerous ways of doing it with one ssc, just think about it logically and do it the way that seems most natural. If you cant think of a way of doing it because its too complicated... maybe you shouldnt be doing it.
i totally agree with this. a cube is really a basic shape, either with point-to-point coding in one scope or with 6 scopes synchronized. if you can't do this, stay with the less-code side of AVS. you know, many people started that way, no 3D and superscopes, still, they were and are amazing artists. speaking about for example horse-fly, yathosho, tuggummi didn't know 3D also in the first few packs.
MaTTFURY
10th December 2004 07:55 UTC
point=(point+1)%4;
x1=-equal(point,0)+equal(point,1)+equal(point,2)-equal(point,3);
y1=equal(point,0)+equal(point,1)-equal(point,2)-equal(point,3);
x1=x1*0.2;
y1=y1*0.2;
x = x1+0.2; y = y1+0.2; z = -0.2; //plane 1
x2 = x2-0.2; y2=y2-0.2; z2= 0.2 //plane2
x3 = x3+0.2; y3=y3+0.2; z3= -0.2 //plane 3
x4 = x4-0.2; y4 =y4-0.2; z4=0.2 //plane 4
x5 = x5+0.2; y5 = y5+0.2; z5 =-0.2 //plane 5
x6 = x6-0.2; y6 = y6-0.2; z6=0.2 //plane 6
now what should i add in? nothing appears in the visual part of it...
Cat Squared
14th December 2004 00:33 UTC
Shouldn't shit like this be put under the AVS\Presets forum???
Oh wait....guess who started this thread>>>>MaTTFURY:hang:
MaTTFURY
14th December 2004 00:47 UTC
no point in holding a grudge to me i already feel like shit :(
S-uper_T-oast
14th December 2004 01:41 UTC
Cat Squared,
http://www.pricenetwork.ca/gallery/a...10047/stfu.jpg
And this is a plenty good fourm for this type of question.
About the cube, you don't need to go about and do all that stuff with planes like that, you just take a cube and use dots to draw a line all around it.
Cat Squared
20th December 2004 18:27 UTC
Ahh its all fair in love and flaming MaTTFURY.
and its cool now...aiiight?:p ;)
UnConeD
20th December 2004 20:10 UTC
x = x1+0.2; y = y1+0.2; z = -0.2; //plane 1
x2 = x2-0.2; y2=y2-0.2; z2= 0.2 //plane2
x3 = x3+0.2; y3=y3+0.2; z3= -0.2 //plane 3
x4 = x4-0.2; y4 =y4-0.2; z4=0.2 //plane 4
x5 = x5+0.2; y5 = y5+0.2; z5 =-0.2 //plane 5
x6 = x6-0.2; y6 = y6-0.2; z6=0.2 //plane 6
What the heck is this supposed to do? The only variables that matter to a superscope are "x" and "y" as far as geometry goes. You need to output the points of your cube in order as "i" goes from 0 to 1.
AVS code consists of expressions and assignments, not equations.
PAK-9
20th December 2004 21:19 UTC
Originally posted by UnConeD
AVS code consists of expressions and assignments, not equations. [/B]
Well, except for movements and DM's
hboy
20th December 2004 21:20 UTC
Originally posted by UnConeD
What the heck is this supposed to do? The only variables that matter to a superscope are "x" and "y" as far as geometry goes. You need to output the points of your cube in order as "i" goes from 0 to 1.
AVS code consists of expressions and assignments, not equations. [/B]
The main problem is he does understand too little code, at least not enough for making nice presets. Maybe he doesn't understand anything, though I doubt that.
MaTTFURY
20th December 2004 22:35 UTC
my name is mattfury...
seriously though, what do you mean OUTPUT as in HOW?
sidd
21st December 2004 13:21 UTC
mattfury: please don't take this the wrong way, but you are trying to get into a topic that is slightly beyond your understanding. You need to first develop a good understanding of how AVS works before you can start making 3d presets.
The following is not what you asked for, but please try it anyway, and PLEASE don't come back and ask about 3D again until you completely understand how this code works.
INIT:
n=5 //the scope will have 5 points.
FRAME:
point=0; //We use the variable "point" to count which
//corner we are up to in the per point section. We need to reset it
//each frame or it will keep increasing larger and larger.
angle=angle+0.01; //each frame we angle increases slightly so that the
//shape appears to rotate smoothly.
af=w/h //since the avs window isn't always square, we need
//to make sure our shape doesn't get stetched. To do this, we multiply
//the y axis by the width/height of the avs window (don't worry if you
//don't get it, just remember to do it)
POINT:
//this section will be run 5 times every frame, one for
//each of the points on our scope. To keep track of which point we are up
//to, I have use the variable "point". eg. If point is equal to 0, we are
//up to the first point.
//look the line for tempX, if point is equal to 0, 3 or 4, tempX will
//be 0.5. otherwise it will be -0.5.
//tempY is similar, this is how we create our shape.
tempX=equal(point,0)+equal(point,3)+equal(point,4)-0.5;
tempY=equal(point,2)+equal(point,3)-0.5;
//this is the rotation sequence that you have probably
//already had explained to you. As i explained, "angle" is increasing
//slightly every frame, making the shape rotate around.
x=tempX*cos(angle)-tempY*sin(angle);
y=tempX*sin(angle)+tempY*cos(angle);
y=y*af;//see the note on af in the frame section
point=point+1;//go on to the next point.
There. feel free to ask questions about this. but don't go asking about 3D until you understand it all.
MaTTFURY
23rd December 2004 09:33 UTC
tempx/y are a variable or constant?
hboy
23rd December 2004 10:31 UTC
Originally posted by MaTTFURY
tempx/y are a variable or constant?
constant is a type of variable. there are mainly two types: constant (their values are added once and then left that way) variables and dynamic (their value is changed over time)variables.
guess of which kind are these then ;) if you assign points to it like the way sidd did it, it is a constant variable because it is not dynamically changed. but if you would do it dynamically it would be a dynamic variable. i wont explain how you do it dynamically.
TomyLobo
23rd December 2004 22:23 UTC
actually, there are no "constant variables", because that'd be a contradiction ;)
constants are:
$pi, $e and so on
numbers like 1.2345
and that's about it
variables are:
things like a, d, u, foo, moo,
some variables are pre-set by the component you write your code into (such as red, green, blue, b, i and v for SuperScope)
others are read by the component and evaluated for rendering (like n, red, green, blue, x, y and skip for SuperScope)
MaTTFURY
24th December 2004 06:41 UTC
erm i know what all of those are... :p ok, back to the point... how would i make my code work with that code? another ssc? or rewrite my code?
sidd
24th December 2004 09:37 UTC
You don't understand how my code works.
Ask about the bits you don't understand first, then move on to more complicated things.
To answer your first question, tempX and tempY are variables that are created the first time avs executes the per point code.
They are user defined, which means that they have no special meaning in avs. They are just a place created especially for this scope to store values which will be used later.
You could rename them to anything else, like x1 and y1, and it would do exactly the same thing.
MaTTFURY
24th December 2004 11:29 UTC
ok how do i get mine to work? im lost.... (your code, my code, everyones fucking code :p)
^..^
24th December 2004 12:52 UTC
matt are you sure that you understood sidd's code? thats what you're supposed to do at first! Please do so and try to undesrtand this first step.
DAMN! YOU WONT UNDERSTAND EVERYTHNG AT ONCE!!!
sidd
24th December 2004 13:13 UTC
I am now utterly convinced that mattfury is nothing more than some evil psychology experiment designed to test people's theshold for idiocy.
i totally completely give up. :)
^..^
24th December 2004 13:30 UTC
certainly! That would be the only logical explanation. How else could it be that someone asks for help and -instead of doing as he is told- always knows it better.
Warrior of the Light
24th December 2004 14:01 UTC
Originally posted by ^..^
[..] always knows it better.
true. Then let him answer his own question this time.
MaTT, What's your first idea on how to use this code?
^..^
24th December 2004 15:15 UTC
probably he will contradict himself as well as he contradicts us ;)
MaTTFURY
24th December 2004 22:23 UTC
my first idea was from jaak he told me, faces of a cube, make that many square / lines then connect them
^..^
24th December 2004 23:23 UTC
¿que? What he says?
MaTTFURY
25th December 2004 00:38 UTC
make squares, connect them all
Warrior of the Light
25th December 2004 11:45 UTC
good idea, try it and then post the preset so we can help you further
TomyLobo
26th December 2004 00:50 UTC
think in your head, not on the forum, please :)
and please, learn step by step, do not try to learn the more complex things before learning the basics.
none of us did 3D presets in the first place. all of us had to learn how to code first
MaTTFURY
26th December 2004 02:50 UTC
ok