Processing 加工中利用贝塞尔点绘制人体轮廓
我是新来的。。。我需要帮助处理贝塞尔点的一个问题,我为英语提前道歉,我来自巴西,我在谷歌翻译的帮助下写作 我试图画出人体的“轮廓”(不需要定义面部特征等)(我知道这很复杂),只需要面部轮廓,身体,最后更简单 问题是我会在3D中做,所以你可以旋转,缩放效果,等等 下面我们有两个程序,一个是2D,这将接近我需要做的 在第二个程序中,作为草图在3D中进行绘制,但无法形成如何制作身体轮廓的网格,这就是我需要帮助的 有没有人能给出一些可以转化为处理的算法的提示,来绘制人体的这种结构(轮廓) 我感谢大家的关注,如果课文有点长,我很抱歉,但我认为我应该尽力解释最好的Processing 加工中利用贝塞尔点绘制人体轮廓,processing,Processing,我是新来的。。。我需要帮助处理贝塞尔点的一个问题,我为英语提前道歉,我来自巴西,我在谷歌翻译的帮助下写作 我试图画出人体的“轮廓”(不需要定义面部特征等)(我知道这很复杂),只需要面部轮廓,身体,最后更简单 问题是我会在3D中做,所以你可以旋转,缩放效果,等等 下面我们有两个程序,一个是2D,这将接近我需要做的 在第二个程序中,作为草图在3D中进行绘制,但无法形成如何制作身体轮廓的网格,这就是我需要帮助的 有没有人能给出一些可以转化为处理的算法的提示,来绘制人体的这种结构(轮廓) 我感谢大家
int领粗、头型、肩型、臂型、臀型、下摆型、上摆型、大腿型、手型、腿型、脚型;
无效设置(){
尺寸(显示宽度、显示高度、P3D);
光滑的();
冲程重量(2);
noFill();
冲程(10,50255,80);
Atalizapontos();
}
作废提款(){
背景(255);
desenhaCorpo();;
}
void atalizapontos(){
颈厚=3;
头型=0;
肩长=5;
手臂大小=-1;
臀围=-3;
lowerSize=-5;
大写=2;
大腿尺寸=-5;
手工尺寸=15;
legSize=0;
足径=14;
}
void desenhaCorpo(){
头部(头型);
颈(颈粗);
肩(肩大小);
上臂(手臂大小);
臀部(臀围);
lowerBody(lowerSize);
上身(上身尺寸);
大腿(大腿尺寸);
膝盖骨();
手(手);
腿(腿大小);
英尺(英尺大小);
}
空磁头(int磁头大小){
贝塞尔(300,70,308,30,372,30,385,70);//头皮
贝塞尔(300,70,300头型,120,315头型,135,320,140);//侧面
贝塞尔(385,70385+头像尺寸,120370+头像尺寸,135365,140);//侧面
贝塞尔(320140340155345155365140);//琴
}
空心颈部(内部颈部宽度){
贝塞尔(320140325颈宽,170320颈宽,180315180);//左颈
贝塞尔(365、140、355+颈宽、170、365+颈宽、180、365、180);//右颈
}
空心路肩(内部路肩宽度){
贝塞尔(210200305190肩宽,310185肩宽,315180);//左斜方肌
贝塞尔(365,180,370,190肩宽,380,195肩宽,480,200);//右斜方肌
贝塞尔(210200205205205205205205200220);//左肩
贝塞尔(480,200,485,205,485,205,490,220);//右肩
}
空心上半身(int upperWidth){
贝塞尔(240250245UpperWidth,300+upperWidth,250+upperWidth,325+upperWidth,275325);//左胸
贝塞尔(450250450+上宽,300+上宽,430+上宽,325+上宽,415325);//右胸
贝塞尔(330,300,325,320,320,320,300,325);//内乳
贝塞尔(360300370320375 320390325);//内乳
}
void lowerBody(int lowerWidth){
贝塞尔(2603203260LowerWidth,350+lowerWidth/27270 lowerWidth,380+lowerWidth/2265415);//左侧
贝塞尔(430320430+lowerWidth,350+lowerWidth/2420+lowerWidth,380+lowerWidth/2425415);//右侧
}
无效髋部(内部髋部宽度){
贝塞尔(265410265臀围,430255臀围,435260450);//左臀围
贝塞尔(425410425+臀围,430435+臀围,435430450);//左臀围
}
空大腿(内大腿宽度){
贝塞尔(260450240大腿宽,500250大腿宽,525270650);//左大腿侧
贝塞尔(335480340+大腿宽度,500330+大腿宽度,525320650);//右大腿侧
贝塞尔(430450445+大腿宽度,500440+大腿宽度,525420650);//左大腿侧
贝塞尔(360480355大腿宽度,500355大腿宽度,525370650);//右大腿侧
贝塞尔(335、480、340、483、340、483、360、480);
}
无效膝盖骨(){
贝塞尔(27065027065526552655270690);//左膝盖侧
贝塞尔(320650320655325655320690);//右膝盖侧
贝塞尔(420、650、420、655、425、655、420、690);//左膝盖侧
贝塞尔(370,650,370,655,365,655,370,690);//右膝盖侧
}
无效上臂(内角臂宽){
贝塞尔(200,220,190臂宽,300,200臂宽,310,200,350);//左前臂侧
贝塞尔(200350180臂宽425200臂宽500200500);//左臂侧
贝塞尔(240250240+臂宽,300235+臂宽,310235350);//左前臂内侧
贝塞尔(235350240+臂宽,425230+臂宽,450225500);//左臂内侧
贝塞尔(490220500+臂宽,300490+臂宽,310490350);//右前臂
贝塞尔(490350510+臂宽425490+臂宽500490500);//右臂
贝塞尔(450250450armwidth,300455armwidth,310455350);//右前臂内侧
贝塞尔(455350460臂宽,425455臂宽,450465500);//右臂内侧
}
无效指针(内径){
贝塞尔(200、500、210、530、175、560、220、575);//左手
贝塞尔(220,575,225+handWidth,575,220+handWidth,560,225,500);//左手
贝塞尔(4905050480+handWidth,530500+handWidth,560490575);//右手
贝塞尔(465500460Handwidth,575455 handWidth,560490575);//右手
}
空心支腿(整型支腿宽度){
贝塞尔(270690255LegWidth,775265 legWidth,800275850);//左小腿
贝塞尔(320690320+legWidth,775300+legWidth,800300850);//左小腿
贝塞尔(420690435+legWidth,775415+legWidth,800405850);//右小腿
贝塞尔(370690370legwidth,775380legwidth,800380850);//左小腿
}
空脚(int-footWidth){
贝塞尔(275850 250英尺宽,900+英尺宽,280英尺宽,900+英尺宽,300850);//左脚
贝塞尔(405850430+英尺宽,900+英尺宽,400+英尺宽,900+英尺宽,380850);//左
import remixlab.proscene.*;
Scene scene;
float px[], py[], mesh[][][];
void setup() {
size(displayWidth, displayHeight, P3D);
smooth(); //Suavição de Contorno
lights(); //Inicia Luzes no ambiente
//Inicia ambiente para Cena
scene = new Scene(this);
scene.setAxesVisualHint(false);
scene.setGridVisualHint(false);
scene.showAll();
//Cria Matriz para a malha
px = new float[40];
py = new float[40];
float t = 0;
for(int i = 0; i < px.length; i++) {
px[i] = bezierPoint(50, 130, 130, 50, t);
py[i] = bezierPoint(450, 350, 150, 50, t);
//px[i] = bezierPoint(300, 308, 370, 300, t);
//py[i] = bezierPoint(70, 30, 30, 70, t);
t += (1.0/(float)(px.length-1));
ellipse(px[i], py[i], 5, 5);
println(t);
}
//Cria Malha
mesh = createMesh(px,py,20, -60,60);
//mesh = createMesh(px,py,170, -360,360);
scene.startAnimation();
}
void draw() {
background(0);
ambientLight(128, 128, 128);
directionalLight(255, 255, 255, 0, 1, -100);
//head(-3);
stroke(255);
//noStroke();
//fill(255,120,0);
drawMesh(mesh);
}
void head(int headSize) {
fill(255);
bezier(300, 70, 30, 308, 30, 30, 372, 30, 30, 385, 70, 30); //scalp
bezier(300, 70, 30, 300-headSize, 120, 30, 315-headSize, 135, 30, 320, 140, 30); //side
bezier(385, 70, 30, 385+headSize, 120, 30, 370+headSize, 135, 30, 365, 140, 30); //side
bezier(320, 140, 30, 340, 155, 30, 345, 155, 30, 365, 140, 30); //chin
}
//Desenha Malha
void drawMesh(float mesh[][][]) {
//println(mesh.length+" "+mesh[0].length+" "+mesh[0][0].length);
for(int i = 0; i < mesh.length-1; i++) {
beginShape(QUAD_STRIP);
for(int j = 0; j < mesh[0].length; j++) {
vertex(mesh[i][j][0], mesh[i][j][1], mesh[i][j][2]);
vertex(mesh[i+1][j][0], mesh[i+1][j][1], mesh[i+1][j][2]);
}
endShape();
}
}
//Cria malha
float [][][] createMesh(float px[],float py[],int numrot, float startDeg,float endDeg) {
float deg, x, z;
double cosval, sinval, tmp1, tmp2;
float [][][] mesh = new float[numrot][px.length][3];
endDeg -= startDeg;
for(int i = 0; i < numrot; i++) {
deg = radians(startDeg + (endDeg/(float)(numrot-1)) * (float)i);
for(int j = 0; j < px.length; j++) {
x = px[j];
z = 0;
cosval = Math.cos(deg);
sinval = Math.sin(deg);
tmp1 = x * cosval - z * sinval;
tmp2 = x * sinval + z * cosval;
mesh[i][j][0] = (float) tmp1;
mesh[i][j][1] = py[j];
mesh[i][j][2] = (float) tmp2;
}
}
return mesh;
}
import remixlab.proscene.*;
Scene scene;
void setup() {
size(800, 600, P3D);
noFill();
stroke(255);
background(0);
head(-3);
scene = new Scene(this);
scene.setAxesVisualHint(false);
scene.setGridVisualHint(false);
//scene.showAll();
}
void draw() {
//background(0);
//head(-3);
}
void mousePressed(){
background(0);
head(-3);
}
void head(int headSize) {
//fill(255);
bezier(300, 70, 30, 308, 30, 30, 372, 30, 30, 385, 70, 30); //scalp
bezier(300, 70, 30, 300-headSize, 120, 30, 315-headSize, 135, 30, 320, 140, 30); //side
bezier(385, 70, 30, 385+headSize, 120, 30, 370+headSize, 135, 30, 365, 140, 30); //side
bezier(320, 140, 30, 340, 155, 30, 345, 155, 30, 365, 140, 30); //chin
}
import toxi.geom.*;
import toxi.geom.mesh.*;
import toxi.processing.*;
import peasy.*;
TriangleMesh mesh;
ToxiclibsSupport gfx;
PeasyCam cam;
int zoom = 30;
void setup() {
size(displayWidth, displayHeight, P3D);
mesh = (TriangleMesh)new STLReader().loadBinary(sketchPath("Exemplo.stl"),STLReader.TRIANGLEMESH);
gfx = new ToxiclibsSupport(this);
cam = new PeasyCam(this, 800);
cam.setMinimumDistance(10);
cam.setMaximumDistance(800);
noStroke();
}
void draw() {
background(0);
rotateX(-.2);
rotateY(-.2);
pushMatrix();
translate(0,0,20);
directionalLight(192, 168, 128,0, -1000, -0.5);
directionalLight(255, 64, 0, 0.5f, -0.5f, -0.1f);
scale(zoom);
gfx.mesh(mesh,false);
popMatrix();
}
void keyPressed(){
if (key==CODED) {
if (keyCode == UP) zoom++;
else if(keyCode == DOWN) zoom--;
}
}