Skip to content
Forum Archive

cube-E question

40 posts

MaTTFURY#

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#
😎
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#
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#
oops totally agreed Jaak, i forgot that 😁 and yeah it is also easier to sync 6 squares too 🙂
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
TomyLobo#
here's the cube you'd have to draw (attachment)
each of these incomplete squares has another color
Jaak#
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. 🙄
hboy#
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#
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#
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#
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#
Shouldn't shit like this be put under the AVS\Presets forum???

Oh wait....guess who started this thread>>>>MaTTFURY😔
S-uper_T-oast#
Cat Squared,



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.
UnConeD#
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#
Originally posted by UnConeD
AVS code consists of expressions and assignments, not equations. [/B]
Well, except for movements and DM's
hboy#
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.
sidd#edited
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.
hboy#
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#
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#
erm i know what all of those are... 😛 ok, back to the point... how would i make my code work with that code? another ssc? or rewrite my code?
sidd#
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#
ok how do i get mine to work? im lost.... (your code, my code, everyones fucking code 😛)
^..^#
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!!!