从零开始构造几何体(CREATING GEOMETRY FROM SCRATCH)

Here we explain how to generate geometry procedurally. There are two node types that allow tho do this: Nodes of type Attribute Wrangle allow to specify geometry using the programming language VEX. Nodes of type Python allow to do the same in the Python language. In general you should keep in mind the following: Quite often the same task implemented in VEX leads to a much better performance than the corresponding implementation in python. The reason is that VEX is compiled on the fly in such a way as to exploit all available possibilities for parallelization. On the other hand, Python offers a wealth of numerical libraries. This means that many tasks have to be done in Python, but the standard choice should be VEX.


一般推荐使用VEX语言,VEX语法与C语言差不多。Python推荐使用复杂数学计算时使用。Attribute Wrangle节点可以用来构造点面属性。

VEX构造几何体(VEX Code Geometry)

// VEX code example
// this code runs over "detail" (see wrangle parameters)

// create a basic geometry

// grab index of it's own geometry
int geo = geoself();
// add 5 points to that geometry
// and remember their indices.
int p0 = addpoint(geo,{0,0,0});
int p1 = addpoint(geo,{.5,.5,.5});
int p2 = addpoint(geo,{.5,-.5,-.5});
int p3 = addpoint(geo,{-.5,.5,-.5});
int p4 = addpoint(geo,{-.5,-.5,.5});

// define a function to create triangles
int addtriangle(const int g,p,q,r) {
 // create a polygon index
 int f = addprim(g,"poly");
 // and add vertices to the polygon
 addvertex(g,f,p);
 addvertex(g,f,q);
 addvertex(g,f,r);
 return f;
}

// add the 6 triangles
addtriangle(geo,p0,p1,p2);
addtriangle(geo,p0,p1,p3);
addtriangle(geo,p0,p1,p4);
addtriangle(geo,p0,p2,p3);
addtriangle(geo,p0,p2,p4);
addtriangle(geo,p0,p3,p4);

在这里插入图片描述
在这里插入图片描述
同时也能使用python构建。
这里只单纯的尝试几何体的构建
hip:https://pan.baidu.com/s/1aB5mIJwuR0QOqbJRVR2sOA
原文:https://wordpress.discretization.de/houdini/home/introduction/creating-geometry-from-scratch/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值