我目前正在尝试挤出使用Adobe Illustrator中的SVG文件创建的PShape
。我目前的方法+图片发布在下面:
z
offset 连接两个形状的每个顶点并使其成为QUAD_STRIP
PShape group = createShape(GROUP);
//1. Create the base image shape
PShape s = createShape(0); //Base Shape
//2. Create a copy of the base image with `z` offset
PShape s2 = createShape(offset);
//3. Connect each vertex from both shapes and make it a `QUAD_STRIP`
PShape connect = connectShapes(s, s2, offset);
group.addChild(s);
group.addChild(s2);
group.addChild(connect);
shape(group, 0, 0, size, size);
PShape createShape(int offset){
PShape s = loadShape("logo.svg");
s.translate(0,0,offset);
return s;
}
PShape connectShapes(PShape normal, PShape extruded, int offset){
PShape normalChild = normal.getChild(0);
PShape extrudedChild = extruded.getChild(0);
println("normalChild.getVertexCount(): " + normalChild.getVertexCount());
println("extrudedChild.getVertexCount(): " + extrudedChild.getVertexCount());
PShape s = createShape();
s.beginShape(QUAD_STRIP);
for (int i = 0; i < normalChild.getVertexCount(); i++) {
PVector n = normalChild.getVertex(i);
PVector e = extrudedChild.getVertex(i);
s.vertex(n.x, n.y, 0);
s.vertex(e.x, e.y, offset);
}
s.endShape();
return s;
}
我试图模仿......
我的代码正在做什么......
更新:
添加了SVG source
答案 0 :(得分:0)
最终图像似乎是根据PShape.getVertex(int i)
的实现。徽标的圆形部分是Bézier曲线,由控制点表示,这些是getVertex
返回的点。你需要的是获得曲线上的点。你可以通过例如: