how to get the range of points?
in
Programming Questions
•
10 months ago
Hi, I'm a newbie here and programming in Processing.
I'm making a test, intead of draw everything in Illustrator, to generate by Processing.
I've a box, and a circle inside. I wanna make some lines from 1 pont of the circle to another point in the box. But need to know the range of points that I can link without trespassing the tangent of the point.
Well, I draw what I want it.
And also what I program until now.
I'm making a test, intead of draw everything in Illustrator, to generate by Processing.
I've a box, and a circle inside. I wanna make some lines from 1 pont of the circle to another point in the box. But need to know the range of points that I can link without trespassing the tangent of the point.
Well, I draw what I want it.
And also what I program until now.
- float centroX, centroY;
float raioMenor;
float inicioCon;
float pontosFin;
int numeroPontos=40;
int numeroPontosQuad=40;
float interv = 2*PI/numeroPontos;
float intervQuadX;
float intervQuadY;
float pontoAnterior=0;
float angPonto;
int [] pontosX= new int[numeroPontos];
int [] pontosY= new int[numeroPontos];
int [] pontosXQuad = new int [numeroPontosQuad];
int [] pontosYQuad = new int [numeroPontosQuad];
void setup(){
size(600,600);
centroX=width/2;
centroY=height/2;
raioMenor = width*0.15;
intervQuadY= height/numeroPontosQuad;
ellipseMode(RADIUS);
angPonto=0;
for (int i =0;i<pontosX.length;i++){
pontosX[i]=(int)(centroX+raioMenor*cos(angPonto));
angPonto+=interv;
}
//println(pontosX);
angPonto=0;
for (int i =0;i<pontosY.length;i++){
pontosY[i]=(int)(centroY+raioMenor*sin(angPonto));
angPonto+=interv;
}
//println(pontosY);
angPonto=0;
for (int i =0;i<pontosXQuad.length;i++){
pontosXQuad[i]=(int)(pontoAnterior);
intervQuadX= (width/numeroPontosQuad);
pontoAnterior+=intervQuadX;
println ("pontosXQuad["+i+"]" + pontosXQuad[i] + "pontoAnterior" + pontoAnterior + "intervQuadX" + intervQuadX);
}
pontoAnterior=0;
for (int i =0;i<pontosYQuad.length;i++){
pontosYQuad[i]=(int)(pontoAnterior);
intervQuadY= (height/numeroPontosQuad);
pontoAnterior+=intervQuadY;
}
pontoAnterior=0;
}
void draw(){
background(255);
pintaPontos();
}
void pintaPontos(){
for(int i = 0;i<numeroPontos;i++){
fill(0);
ellipse(pontosX[i], pontosY[i],1,1);
}
for(int i = 0;i< pontosXQuad.length;i++){
fill(0);
ellipse(pontosXQuad[i],0,1,1);
}
for(int i = 0;i< pontosXQuad.length;i++){
fill(0);
ellipse(pontosXQuad[i],height,1,1);
}
for(int i = 0;i< pontosYQuad.length;i++){
fill(0);
ellipse(0,pontosYQuad[i],1,1);
}
for(int i = 0;i< pontosYQuad.length;i++){
fill(0);
ellipse(width,pontosYQuad[i],1,1);
}
}
1