【发布时间】:2014-11-12 00:57:00
【问题描述】:
我有这个处理草图,我试图在其中加载模型(.stl 或 .obj)并为每个边缘交叉点构建参数化套接字连接点。这些将是 3D 打印的,并且适当规格的杆将插入它们的孔中。
我已经能够在顶点处绘制球体(在模型上以 红色 表示),但我无法生成 绿色 插槽甚至杆粉红色:
我可以得到模型边缘的坐标:
id: 0 0 {-25.805634,-23.170607,13.6315975} -> 1 {-16.868328,-10.148323,6.785455} f: 2
id: 1 1 {-16.868328,-10.148323,6.785455} -> 2 {-52.833824,-10.148322,16.799314} f: 2
....
有了这些我可以画一个Line3D(Vec3D a, Vec3D b) (toxi.geom.Line3D)
但我不想要 Line3D,我需要在它们之间画一个圆柱体,从而得到杆。如果您愿意的话,可以将线条拉伸或膨胀为 3D 体积...
WETriangleMesh whale, redmesh;
[bla bla bla]
然后在void setup()里面:
for(WingedEdge e : whale.edges.values()) {
edges.add(e);
drawSocket(e);
}
void drawSocket(WingedEdge e) {
// draw size 2 balls at model vertices
Sphere ball = new Sphere(e.a, 2);
// convert to mesh at resolution 6 and add to redmesh
ball.toMesh(redmesh, 6);
}
然后在void draw():
// draw the mesh with the whale
gfx.mesh(whale);
// color the next mesh red
fill(255,0,0);
// draw the mesh with the spheres
gfx.mesh(redmesh);
我发现没有可以从Vec3D a, Vec3D b 参数就地构建的 3D 形状类。也许创建一个类来使用这两个坐标?
如果就地构建形状太难了,那么也许是变换? pushMatrix()translate()和popMatrix()?
编辑:已解决,见下文。谢谢!
【问题讨论】:
标签: vector 3d processing 3d-modelling