now i am new to processing environment (using java) but i have much experience in java, other day I needed to sketch up some mathematical functions/parametric equations, now before you say...MATLAB is for that only...I must let you know that i know only java.
So basically the main part is the absolute value of sine function that i needed to draw, i was able to do it, but all i had trouble with was that i wanted to limit my sine curve to some constraints, Since i am using parameteric equation for this, i have a variable float t
as my parameter.
one way i can find is to get co-ordinates of start and end of curve and limit/condition my loop to only print in those limit of x.
Other novice way was to set values of my parameter accordingly.
Later worked like charm however 1st one didnt, maybe i am loosing some concept or skipping something, if u would please help me :) , code goes as follows:
float t=-80;
void setup()
{
background(20);
size(500,500);
stroke(255);
strokeWeight(5);
println(" "+X+" "+Y);
translate(width/2,height/2);
for(;t<=80;){
if(x(t)>218 && x(t)<281)
{
point(x(t), y(t));
}
t++;
}
}
void draw() {println (mouseX +"," + mouseY);}``
float x( float t)
{
return t;
}
float y(float t)
{
return abs(30*sin(t/10));
}
please help also i have schematics of what i want to actually say