CityEngine--comp() operator

1、comp( ){ } operator
comp( compSelector ){ selector operator operations | … }
参数:
compSelector–关键字
f – faces.
e – edges.
fe --face edges
v – vertices
g – groups
m – materials
h – holes

selector–关键字
(1) { front | back | left | right | top | bottom }
官方解释:The y-normals of the components are analyzed by classifying their directions into the corresponding quadrants (in relation to the local coordinate system of the current shape.---------------------------------------局部坐标系
个人理解:该关键字是为了将所建立方体的每个平面(组件)单独分割成一个可进一步规则化的组件(对象)
例如如下:

version "2016.0"

@startrule
Lot-->
   extrude(100)
   //color(0,128,0)
   //Building
   Building2
Building2-->
   comp(f){front:frontFaced|back:backfaced|left:leftfaced|right:rightfaced|top:topfaced|bottom:bottomfaced}
frontFaced-->
   color(1,1,1)
backfaced-->
   color(0,0,0)
leftfaced-->
   color(1,1,0)
rightfaced-->
   color(1,0,1,0.5)
topfaced-->
   color(1,0,0,0.5)
bottomfaced-->
   color(1,0,1)

规则化后的模型样子如下所示:
在这里插入图片描述
在这里插入图片描述
(2){ object.front | object.back | object.left | object.right | object.top | object.bottom | object.side}
官方解释:The y-normals of the components are analyzed by classifying their directions into the corresponding quadrants (in relation to the object coordinate system of the current initial shape.-------------------------目标对象物体坐标系
个人理解:

规则代码如下:

Lot-->
   //envelope(normal, maxHeight, frontBaseHeight, frontAngle, backBaseHeight, backAngle, sideBaseHeight, sideAngle,leftBasedHeight,leftAngle)
   extrude(20)
   //color(0,1,1,0.3)
   building
building-->
   comp(f){ object.front:frontfaced | object.back:backfaced | object.left:leftfaced | object.right:rightfaced | object.top:topfaced | object.bottom:bottomfaced | object.side:sidefaced}   
frontfaced-->
   color("#EE82EE")
backfaced-->
   color(0,1,1,0.5)
leftfaced-->
   color(0,0,1,0.2)  
rightfaced-->
   color("#4B0082")
topfaced-->
  color("#191970")
bottomfaced-->
  color("#7FFFAA")
sidefaced-->
  color("#FFFF00")  

规则化后的模型如下所示:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值