Color Mass By Orientation

cityengine2016.1版本,cityengine2017年第二个新案例ESRI官方发布啦,这个案例说的什么鬼,或许能让你联想到arcgis pro 1.4的某些影子。

ArcGIS Pro?1.4新增multipatch编辑功能。如下:

1)在3D模型中创建multipatch 要素

2)拖拽现有的面、增加一个新的面、向内或向外拉伸面,或是创建一个空洞

3)沿着面创建山脊线,拖动它就可创建两个相交的面,例如三角形屋顶

3)复制一个2D多边形到multipatch图层,然后运用选择性粘贴(paste special),将其凸起为一个multipatch要素

 

 

 

AColorMassByOrientation

 

 

CityEngine函数库更新历史


City Engine version (= CGA version)Changes2016.0
CGAC 1.6New operations:

Changes to existing features:

  • setNormals operation:
    • New mode auto that uses softenNormals functionality.
    • New mode conform that computes consistent normals.
  • The innerRect operation is deprecated. Use innerRectangle operation instead.
  • cleanupGeometry operation: Mode all/faces: All duplicate/inverse faces are removed except one (independent from orientation).
  • i operation:
    • New parameter upAxisOfGeometry that specifies the up axis of the geometry.
    • New parameter insertMode that specifies the alignment and positioning of the geometry in the scope.
    • The usage of s(0,0,0) is deprecated. Use keepSizeAndPosition asinsertMode instead.
  • “builtin:cube” and “builtin:cube:notex” are deprecated. Use primitiveCube instead.
  • extrude operation:
    • The paramater axisWorld is deprecated and changed to a parameterextrusionType.
    • New types face.normal, vertex.normal, world.up and world.up.flatTop.
    • The axes x, y, z, world.x, world.y and world.z are deprecated. Use typeworld.up instead of axis world.y.
  • roofGable, roofHip, roofPyramid and roofShed operation:
    • Roofs can be generated wrt. a given height.
    • New parameter valueType to switch beetween a roof generation byAngle orbyHeight.
  • roofShed operation: For shed roofs on shapes with one face no horizontal trim planes, hip, valley and ridge edges are generated. This was already the case for shapes with more than one face.

Bugfixes:

  • split, trim and i operation: Fixed a bug that led to wrong results when vertices or edges lie in the respective split/trim plane.
  • geometry.isInstanced function: Fixed for builtin primitives (“builtin:cube” and“builtin:cube:notex”). Also supports primitiveQuad, primitiveDisk, primitiveCube,primitiveSphere, primitiveCylinder and primitiveCone.
  • roofHip, roofGable operation: Fixed a bug that occured on rectangular shapes and led to a wrong shading due to double vertices.
  • roofShed operation: Fixed a bug that generated wrong shed roofs for shapes with more than one face, at least one hole and a non-zero edge index set.
  • cleanupGeometry operation: Fixed an issue that prevented vertices to merge when they were the first vertex in a face.
  • geometry.area and normal calculation became more accurate; floating point precision got improved in general.

2015.2
CGAC 1.5bugfixes:

  • getGeoCoord function: fixed a bug where selectors lat, lon did not return the correct WGS84 coordinates for some coordinate systems.

2015.1
CGAC 1.5new features:

  • Support for reading FBX assets.

bugfixes:

  • comp operation: fixed a numerical issue which led to missaligned faces after comp(f).
  • cleanupGeometry operation: made it behave the same on edge cleanup for geometries with per-mesh-materials and per-face-materials.

2015.0
CGAC 1.5new functions:

changes to existing features:

  • split operations:
    • missing sizes are not allowed any longer. For instance, split(x)?{?A?} does not compile anymore. The correct equivalent is split(x)?{?~1:?A?}.
    • functions in size expression do not need extra parantheses anymore.
  • @Hidden annotation: changed propagation across imports. A hidden import hides all its imports recursively.
  • uid shape attribute deprecated. Use the getTreeKey function instead.

bugfixes:

  • Fixed a bug in the cgb decoder which failed to read compiled cga files with a large number of attributes/rules/splits.
  • Vertexmerger: fixed a bug which prevented hole vertices to be merged with vertices of other faces.
  • float() function: made string-to-float conversion independent of locale.
  • split operations: intensified internal mesh cleanup to reduce memory load, fixed a bug which led to undesired vertex-merges.
  • roofHip operation: avoid duplicate vertices.
  • offset, roofGable and roofHip operations: made offset / roof construction more stable on polygons with co-linear vertices and fixed a memory explosion bug.
  • cleanupGeometry operation: fixed bug which led to illegal material assignements (“filled holes rendering bug”) on edge cleanup for geometries with per-face-materials.
  • Fixed undefined behaviour if the same name was used for a scalar attr and a map attr.
  • CGA compiler: Parameteric rules and functions with a large number of parameters do not hang the compiler / CityEngine anymore.

2014.1 QF1
CGAC 1.4bugfixes:

  • CGA compiler: Fixed a bug in code generation for styles which led to mixed-up styles in the .cgb files.
  • offset, roofGable, roofHip and roofShed operations: made polygons with holes handling more stable for illegal holes (hole vertices identical to vertices of enclosing polygon – hangers).

2014.1
CGAC 1.3new operations:

new functions:

new CGA Utility Library functions:

new features:

changes to existing features:

  • Changed the defaults for recursion detection:
    • Maximum derivation depth: from 99 to 1024.
    • Maximum derivation width: from 50000 to 100000.
    • Maximum function call depth: from 256 to 1024.
  • Optimized function memory overhead (i.e. more interleaved functions beyond the default limit are possible now before crash – actual limit depends on platform & function).
  • Collada reader: added support for polygons with holes.
  • str function and print, report operations: made float-to-string conversion independent of locale (some numbers might be formatted differently now).
  • Internal geometry cleanup: improved handling of illegal holes (overlapping holes, wrong vertex order).

bugfixes:

  • extrude operation: fixed polygon with holes handling.
  • convexify operation: fixed face consistency if several edges have identical length.
  • envelope operation: fixed border cases which led to “open volumes”.
  • alignScopeToGeometry operation: fixed points/edge shapes support: scope size was set to 1 rather than 0, pivot orientation was not set to vertex/edge normal, fixed a crash if illegal edge index was used on edge geometry.
  • setback and shape{L|U|O} operations: fixed memory leak.
  • split operations: fixed hole handling (produced illegal holes in certain cases).
  • offset, roofGable, roofHip and roofShed operations: made polygons with holes handling more stable for illegal holes (hangers).
  • assetInfo, assetsSortRatio and assetsSortSize functions: fixed behaviour for unknown/unloadable assets.
  • material shape attribute: material.XXXmap returns “builtin:unknowntexture.png” if texture not found.
  • Fixed (deprecated) noStreetSide comp split selector handling.
  • Fixed a bug regarding edge/point geometry normals (CityEngine rendering only).
  • Fixed a bug in handling edges in empty geometries.
  • i operation: fixed a race condition in handling unknown assets which led to a crash.
  • Fixed an internal illegal pointer access which led to a crash.
  • print, report, set operations: fixed nan handling (avoid checks) and removed excess newline (bool).
  • str function: fixed inf/nan handling.
  • listRange function: fixed a bug reading (illegal) non-?;?-terminated string list handling.
  • improved internal rad-to-degree conversion precision.
  • AssetErrors: report warnings from geometry conversion of inserted assets.
  • Fixed a vertex merge issue in trim/split (identical vertices were not merged).
  • CGA compiler:
    • Fixed a bug in extends (attribute values were not always propagated).
    • Fixed bugs in import (wrong attributes copied, protecting selected attributes did protect all attributes).
    • Fixed a bug which led to a compile error if a rule had the same name as a CGA Utility Library function.

2014.0
CGAC 1.2new features:

  • offset, roofGable, roofHip, roofShed operations: holes in polygons are now supported.
  • setback operation: new syntax for selecting uv sets and new uv-based selectorsuv.left, uv.right, uv.bottom, uv.top; uv coordinates and vertex normals are not deleted anymore but interpolated for new inner vertices.
  • tileUV operation: using 0 for the textureWidth or the textureHeight parameter protects that coordinate from beeing touched.

changes to existing features:

  • import: attr value propagation logic was simplified.

bugfixes:

  • import: resolving assets from cross-project imports failed in some cases (imports which imported a cga file from the same directory). This was fixed in the cga compiler (CGAC), so existing rpks should be updated.
  • assetApproxRatio, assetApproxSize, assetBestRatio, assetBestSize, assetFitSize,fileRandom, imageApproxRatio, imageBestRatio functions: fixed a bug which led to wrong asset lookups if imported from a different project.
  • geometry.angle function: fixed a bug which led to wrong results.
  • fileSearch function:
    • hits in the current project were reported in relative path notation; this got changed to absolute workspace paths again.
    • crash fixed if illegal regexps were used in attr initialization
    • spaces within qoutes were broken
  • initialShape attributes returned wrong values if used in const / attr functions.
  • comp operation: for polygons with holes, the border, insider selectors and the =operator were buggy.
  • imageInfo function: does not crash anymore on empty filename.
  • imagesSortRatio function: does not crash anymore on empty fileList.
  • split operation: fixed a bug which led to deletion of the last leaf of a uv-split in some cases.
  • inside function: fixed a bug which led to wrong results.
  • Fixed a bug connected to inter-model occlusion of vertically distant initial shapes: ignore neighborhood distance on y-axis for finding potential occlusions.

2013.1
CGAC 1.1changed fundamental behaviour:

  • attr/const functions evaluation order: In previous CGA versions, attr and constfunctions were evaluated lazily, i.e. when they were used for the first time. Remember that attr and const functions are evaluated only once. This approach gave rise to the non-intuitive behaviour that changing the code of some rule potentially changed the value of an attr. Keep in mind that some functions (and obviously shape attributes) depend on the current shape’s geometry, and some even change the state of the current shape (e.g. rand). Therefore (non-)evaluation of a const function cold have an influence on rule execution.
    Starting with 2013.1, all attr/const functions are evaluated before the start rule is applied, on the initial shape with a seedian derived from the initial shape’s seedian. The initial shape’s random number generator state is not affected.
    While the new approach makes CGA coding more “intuitive”, it changes the behaviour compared to older versions.
  • inf/nan checks: In previous CGA versions, a number of operation and function float parameters were tested for not-a-number / infinity (nan/inf) values at runtime. In most cases, such values were replaced with 0 and a warning was issued. In others, the operation was aborted.
    CGA 2013.1 introduces a unified inf/nan behaviour: checking of all float paramers of builtin functionality can be set to either “ignore” (= don’t check), “abort with error” or “replace with zero” see Grammarcore Preferences). The default behaviour is “replace with zero”, which comes closest to the classic behaviour.
    While CGA 2013.1 provides more debugging capabilities regarding inf/nan values, the behaviour is different than in previous versions.
  • Intra-occlusion and reports, print output, CGA error reporting: During resolving inta-occlusion-queries, some shapes and sub-shapetrees get deleted (and re-evaluated). The reports issued by report operations by the rule of that shapes (and the output of print operations and functions plus all CGA errors/warnings) are deleted along with those shapes.
    While the new behaviour makes more sense (each report/print-output/error has associated a shape in the model hierarchy), it is different than in previous versions.

new CGA Utility Library functions:

new features:

changes to existing features:

  • report operation: available with all licenses.
  • reduceGeometry operation: new, more efficient implementation – resulting geometry might differ to previous version.
  • fileExists function: now returns true fo all builtins.
  • material.color.rgb attribute: return a hex string (see color operation) rather than a three-floats-in -[0,1]-string.
  • listClean utility function: empty entries are filtered now.
  • listIndex utility function: support for wildcards.
  • envelope operation: deprecated signatures without direction parameter.

bugfixes:

  • alignScopeToGeometry operation: more robust regarding bad geometry (fixes a crash) and better face material support.
  • assetsSortRatio function: fixed axisSelectorRatio parameter (crashed if yz was used).
  • assetsSortSize function: fixed axisSelectorSize parameter (yz was ignored).
  • envelope operation:
    • fixed missing top faces if one some of the baseHeights were equal tomaxHeight.
    • support for non-planar polygons.
    • fixed several numerical issues (crashes, incorrect geometry).
  • i operation and initial shape handling: added zero-angle removal and better face material support.
  • print function: a newline is added after each invocation (like in the print operation.
  • comp, envelope setback, geometry.area, and geometry.isOriented operations/functions:street.xxx selectors: do not fallback to object.xxx selectors if streetWith sttribute is not defined for index 0 but for other indics.
  • Vertex meger (export + internal to a number of operations): more robust regarding bad geometry (fixes a crash).
  • Triangulator (export, rendering and internal to a number of operations): correctly handle near-identical vertices (led to inconsistent geometry and crashes).
  • Fixed a number of compiler bugs related to import, most important a bug which prevented setting of imported generic attributes.

2012.1new operations:

new functions:

new attributes:

  • uid attribute

new CGA Utility Library functions:

new features:

changes to existing features:

bugfixes:

  • comp operation: using the combine (=) operator in conjunction with edges and vertices (e|v) led to undefined behaviour. fixed.
  • geometry.isOriented operation: world.x selectors were inverted. fixed.
  • i (trimming) and split operations: fixed some bugs which led to inconsistent geometry and increased performance for large geometries. This also speeds up export if vertex merger is on.
  • alignScopeToAxes operation: works now also if the current shapes’ geometry is empty (e.g. after a scatter or comp(e|v) operation), and multi-mesh geometries do not loose materials anymore.

2011.1new functions:

new attributes:

new features:

  • Added support for generic shape attributes: each shape can have its own copy of an attribute, and the value is passed on to the successors. Values can be set with the setoperation.
  • Added support for styles: Rules and attributes can be bundled and named to form a style. All styles derive from the default style. This is somewhat similar to inheritance in OOP.
  • On import of a rule file, attributes can now be protected and styles can be chosen.
  • color operation: added an overload which takes a float tripple.
  • geometry.area function: added object.front, streetSide and noStreedSide selectors.
  • case blocks can now be used between push [ and pop ] operations, i.e. a new scope can be conditional.
  • CGA executen trace for debugging, see Grammarcore Preferences.
  • alignScopeToAxes operation: added x and z selectors.

changes to existing features:

  • material attributes:
    • if the shape material attribute is not modified: return attribute from first geometry asset mesh material (i.e. always return the current value; on older versions, always the shape material value was returned)
    • removed material.ambient.a attribute
    • deprecated material.color.a (replaced by material.opacity) andmaterial.map{3,4,5} (replaced by material.specularmap, material.opacitymap, material.normalmap) attributes
    • changed material.bump to material.bumpValue
    • fundamental changes to transparency handling: the alpha channel ofmaterial.colormap is always ignored now; alpha-maps must be set using thematerial.opacitymap texture layer; similarly, material.opacity must be used instead of material.color.a; rendering: CityEngine’s GL preview now drops fragments with alpha < 0.1, that used to be 0.3. note: all materials with opacity are rendered after all other materials.
    • textures can be disabled by setting the filename to the empty string (i.e.texture(“”) or set(material.opacitymap, “”)); in previous versions, this led to usage of “builtin:unknowntexture.png”; the default materials’s textures are set to the empty string instead of “not available”.
    • If a texture can not be found, the texture name is always set to“builtin:unknowntexture.png”. This is also the case for misspelled“builtin:XXX” textures (which were set to “builtin:default” in previous versions).
  • “builtin:cube” now has texture coordinates for uv-set 0 (colormap) only (was 3: uv-sets 0, 1, 2 in previous versions).
  • For rendering and export, undefined uv-sets default to set 0 now (if 0 is defined), i.e. if e.g. material.opacitymap is set to a valid texture, but uv-set 3 is undefined, the coordinates form uv-set 0 are re-used. This was only the case for specular map before. See also Texturing: Essential Knowledge.
  • fileSearch function (and all related functions in the Utility Library) got reworked:
    • search logic is more strict now (if searchQuery is not an absolute workspace path, match relative to assets and root folders of current project (in old versions, it was tried to match all folders and subfolders)
    • better performance
  • Geometry asset readers: extended consistency checks to handle polygons with collapsed edges and dropped checking for non-planar faces.
  • Removed “drop shapes fully trimmed away” optimization in createShape operation: in older versions, new shapes were not created if they would be completly behind an enabled trimplane.

bugfixes:

  • scatter operation: gaussian distribution: fixed wrong mean calculation for right / bottom cases; led to endless loops in certain cases.
  • vertex merger now respects topology (i.e. export with vertex merging option and all cga-operations are o-shape safe).
  • The setback, shapeL, shapeU and shapeO operations received a facelift, fixing many issues. Notably shapeO is much more stable now.
  • Fixed a fatal recursion-not-detected error in user-defined functions with arguments.
  • uv split operation:
    • fixed crash on geometries w/o uvsets.
    • fixed a precision bug.
  • innerRect operation: fixed shape placement if scope contains rotation.
  • Self-intersecting polygons are handled properly now (scatter, uv split operations and rendering).
  • roofHip operation: fixed a crash in a specific situation (with overhang, on collinear vertices).
  • fixed comp.sel (only contained last word, e.g “front” instead of “object.front”).
  • fixed a bug in convexify: check resulting polys for zero area, remove degenerate ones – led to crashes in follow-op operations in some cases.
  • rotate operation: fixed a bug in scope case (was rotated around pivot, not scope).
  • convert function: fixed a bug in convert((x|y|z), scope, pivot, orient, x, y, z)(was size-sensitive).
  • material-per-face assets: improved support, material now survives deletion of zero-area faces.
  • split / trim fix: cut-exactly-throug-edges situations with >1 points (o-shapes etc.).
  • fixed a bug in intra-occlusion geometry caching (led to wrong results).
  • Collada reader:
    • lines and points are ignored now (they were treaten as polygons in older versions)
    • meshes consisting of textured and non-textured polygons are handled better now (non-textured polygons receive (0,0) uvs on all vertices).
  • Image reader handles 16bit grayscale textures properly now.
  • faster and more stable geometry.area.

2010.3new operations:

new features:

  • comp operation: added world.xxx, object.xxx and streetSide selectors.
  • geometry.area() function now supports component split-style selectors to calculate area of only a subset of the geometry’s faces.

changes to existing features:

  • extrude and taper operation: negative heights do not change the pivot anymore but result in negative scope size.

bugfixes:

  • Fixed a bug in trimming a negative sized scope.
  • color does not touch alpha (used to set it to 1.0).
  • comp operation: corrected scope selectors for negative scope sizes (e.g. front becomes back if scope.sz is < 0).
  • convexify and innerRect operations: fixed a numerical problem concerning collinear vertices: remove’em before the operations.
  • mirrorScope operation: fixed a bug which resulted in wrong translations.
  • roofShed operation: fixed vertex indices for shed roofs on multi-face shapes.
  • offset operation: fixed a bug in the case where no inside/border geometry was generated (due to a too large offset) and the according selector was used.
  • Fixed a compiler bug: functions beginning with &const& or &attr& (eg. construction) were parsed wrongly.

2010.2new operations:

new functions:

new features:

  • split operation now supports splits in the uv (texture coordinates) domain including support for the “unwarped” domain (unitSpace surface parameterization).
  • offset operation: a new overload allows for keeping only inside or border faces.
  • setupProjection operation: a new overload allows for adding a translation offset to the setup scope.

changes to existing features:

  • extrude and taper operations now keep texture coordinates.
  • extrude, taper, roofGable, roofHip, roofPyramid and roofShed operations do net set the pivot anymore and try to maintain the scope’s x-axis orientation as much as possible (i.e. the scope and pivot orientation is different now).
  • alignScopeToGeometry operation: negative indices are supported now (modulo, i.e. -1 is the last face/edge; was unspecified behaviour before).
  • comp(e) operation: edges have now a defined index, i.e. edge 0 is always guaranteed to be the first edge of the first face.
  • roofGable, roofHip and roofShed operations are now guaranteed to put first roof face on first edge of input face in all cases and to put all roof faces on corresponding edge if current geometry consists of one face only.
  • setupProjection operation: deprecated

    setupProjection(uvSet, axesSelector, width, height, uwFactor)

    overload .

  • changed recursion detection: control shape tree width rather than active nodes

bugfixes:

  • Recursive functions did not compile if the arguments were not float.
  • replace function: did replace only the first occurrence, now replaces all occurrences.
  • split and trim operations:
    • now handle concave polygons.
    • now handle negative-sized scopes.
  • Fixed a bug in intra-occlusion (in some cases wrong pre-component-split volume was taken to check against).
  • geometry.isPlanar function: in case of collinear edges nonplanarity was reported.
  • innerRect, convexify, roofGable, roofHip, roofPyramidoperations and roofShedoperations: fixed a numerical issue.
  • alignScopeToGeometry operation: world.lowest selector: if all vertices had y-coordinate exactly on 0.0 result was random.
  • comp operation: if the “=” operator was used in conjunction with a rotated scope, the resulting shape had wrong scope and pivot position.
  • center operation: did not work properly if scope was rotated.

2010.1SR1 new functions:

SR1 changes to existing features:

  • fixed signature matching bug (false syntax errors, eg. with alignScopeToGeometry)
  • fixed wrong asset search path in imported rule files
  • fixed cgalib replace() issue
  • fixed a bug in translate(rel, object, …) operation
  • fixed a bug which led to unreferenced vertices in extrude and roofXXX operations (connected to very thin features).
  • fixed a bug in multi-face-extrude: in special cases some faces got deleted

new operations:

new functions:

new features:

changes to existing features:

  • initialShape.startRule is new and replaces the deprecated initialShape.symbol.
  • Asset and texture search: Now the search for an inserted asset (or texture) is always relative to the rule file and the search locations changed. No search heuristcs are applied anymore, so for instance the asset “assets/windows/window1.obj” must be inserted as i(“windows/window1.obj”); in older versions, i(“window1.obj”) would have found the file (but maybe another one instead, with the same file name, but at a different location in the workspace).
  • s operation: a negative size now leads to a mirrored geometry (with reversed normals) rather than to an implicit translation. Converting rules which used negative sizes is straight-forward: use the posive value and add a t operation, for example this cga codes(‘1,’1,-1.2) OpeningWall(“door”) Door has to be converted to this: s(‘1,’1,1.2) t(0,0,-1.2) OpeningWall(“door”) Door
  • fixed reverse face and mesh order of inserted obj assets – face ids are reversed (comp split!)
  • initialShape.symbol attribute: the signature string (”${}”) was dropped
  • alignScopeToGeometry: (a) New face selectors world.lowest, largest, any. (b) New edge selectors world.lowest, largest and new syntax (combinations of face and edge selectors and indices). (c) Deprecated alignScopeToGeometry(upAxis, faceIndex) andalignScopeToGeometry(upAxis, auto).
  • innerRect operation:(a) Now operates on each face of the geometry (instead of just the first face). (b) Concave faces are handled (they get convexified first and the innerRect is computed on the largest rectangle). (c) Only keeps rectangular faces if they are aligned to x-axis.
  • It is not possible to use the ~ operator anymore in the s, r, t operations – it did not do anything anyway.
  • setupProjection operators ~ and ‘ can now be used.
  • setPivot: no support anymore for “yUp” and “zUp” selectors (use xyz and yzx).

bugfixes:

  • Occlusion: (a) fixed a bug which led to wrong results (b) fixed an intra-occlusion memory leak (c) fixed a bug which could have led to inconsitencies in the exported models.
  • geometry.isConcave function: fixed a numerical issue which led to wrong results.
  • changed const expression evaluation – they are always evaluated → numbers are consistent, also if overriden by inspector value
  • Component split: fixed a bug which led to lost materials if asset contained more than one mesh / material
  • innerRect operation: fixed some numerical issues which led to wrong results.
  • The obj asset reader now handles negative indices (max files)
  • color does not touch alpha (used to set it to 1.0).
  • Better name clashes handling of imported rule files.
  • Stricter type handling, some errors which were only detected during generation before are now detected at complie time.
  • split operation: in some cases (extruded geometry), texture coordinates were repeated rather than split.

2009.3new features:

changes to existing features:

  • Support for trim-planes along concave faces. Trim planes are not infinite anymore, their extent can be controlled in the Grammarcore preferences.
  • roof operation deprecated.
  • offsetUV operation deprecated (is now translateUV).
  • setupUV, bakeUV deprecated (use setupProjection and projectUV operations instead).
  • extrude, roofGable, roofHip and roofShed now handle multi-face initial shapes.
  • inside, overlaps, touches functions: (1) added inter, intra, all selectors. (2) A special configuration (”face is completely covered by a side of a volume”) is now included in the inside case.
  • New settings to control endless recursion detection: (1) limit function call depth, (2) limit nr. of active shapes (detect shapetrees-breadth-explosion), see Grammarcore preferences.

bugfixes:

  • alignScopeToAxes() (only the no-selector default case) did not work properly, fixed.
  • Non-boolean expressions are no longer valid in case statements (led to a run-time error before).
  • Fixed a bug connected to usage of convert() in imported cga files.
  • Using alignScopeToAxes() or alignScopeToGeometry() between setupUV() and bakeUV()resulted in incorrect texture coordinates, fixed with new operations.
  • Fixed a bug in euler angle extraction which sabotaged e.g. convert().
  • extrude operation: fixed indexing of first face.
  • convert function: convert(orient, scope, world | object, …) did not work correctly
  • Component split: (1) using indices on an empty selection no longer crashes. (2) interleaved edge/vertex-comp-splits did not work (resulted in empty selection), fixed
  • inside, overlaps, touches functions: fixed several bugs (dislocated intersection volumes, wrong touches results, lost inter-occluders).

2009.2new features:

changes to existing features:

  • object coordinate system: a shape’s pivot is now relative to initialShape.origin and not relative to the world coordinate system anymore.
  • extrude(axis, h): axis selectors (x | y | z) deprecated; new selectors (world.x | world.y | world.z) change pivot orientation after operation to be the same as afterextrude(h).
  • alignScopeToGeometry: “auto” mode: (1) if all edges are on the same y-coordinate, the longest edge is taken and (2) fixed a bug which led to undefined behaviour in rare cases.

2009.1 and older (keywordversionnot supported)-

splitArea


地块分割函数

类型一:splitArea(splitAxis) { area1 : operations1 | … | arean-1 : operationsn-1 }

类型二:splitArea(splitAxis) { area1 : operations1 | … | arean-1 : operationsn-1 }*

类型三:splitArea(splitAxis, adjustSelector) { area1 : operations1 | … | arean-1 : operationsn-1 }

类型四:splitArea(splitAxis, adjustSelector) { area1 : operations1 | … | arean-1 : operationsn-1 }*

参数

  • splitAxis (selstring)
    (x | y | z) – Name of axis to split along. This is relative to the local coordinate system (i.e. the scope). ? 按本地坐标系的方向
  • adjustSelector
    (adjust | noAdjust) – Optional selector to control scope calculation of the calculated shapes. The default is to adjust the scope to the geometry’s bounding box. Using noAdjust avoids this, and therefore, the scopes of the resulting shapes fill the parent’s scope without gaps.
  • area (float)
    Split area. The current shape is split such that the resulting shape has the specified area. Depending on the prefix, area is interpreted in the following way:

    no prefix (absolute)
    The new shape’s area will be exactly area.
    ‘ (relative)
    The new shape’s area will be area * current geometry’s area.
    ~ (floating)
    With the ~ prefix, the remaining spaces between the split parts with absolute dimensions are automatically adapted. If multiple floating parts are defined within a split, the dimensions are weighed proportionally.
  • operations
    A sequence of shape operations to execute on the newly created shape.
  • *
    Repeat switch: the repeat switch triggers the repetition of the defined split into the current shape’sscope, as many times as possible. The number of repetitions and floating dimensions are adapted to the best solution (best number of repetitions and least stretching).

The splitArea operation subdivides the geometry of the current shape along the specified scope axis into a set of shapes with geometric areas specified by the area parameter. This operation works on planar 2D geometry and almost planar geometry. The area accuracy breaks down with nonplanar geometry. This operation does not apply to 3D geometry such as meshes or highly nonplanar geometry.

For each specified area, the current shape’s geometry is cut with planes perpendicular to the split axis such that the resulting shape contains geometry with the specified area.

The optional repeat switch * can be used to repeat the content within a {…}* block as many times as it fully fits into the scope’s dimension along the selected axis.

Related

Examples

Colors

These are the rules for the colors used in the following examples.
Red     --> color(1, 0, 0)                       // red
            print("area(R) = " + geometry.area)

Yellow  --> color(1, 1, 0)                       // yellow
            print("area(Y) = " + geometry.area)

Green   --> color(0, 1, 0)                       // green
            print("area(G) = " + geometry.area)

Cyan    --> color(0, 1, 1)                       // cyan
            print("area(C) = " + geometry.area)

Blue    --> color(0, 0, 1)                       // blue
            print("area(B) = " + geometry.area)

Magenta --> color(1, 0, 1)                       // magenta
            print("area(M) = " + geometry.area)

Pink    -->                                      // semi-transparent pink
            color(1, 0.5, 0.5, 0.3)

Relative Split 相对拆分


Lot -->
   print("total area = " + geometry.area)
   splitArea(x) { '0.7 : Green
                | '0.3 : Yellow }

This shape is split into two parts. The first part is 70% of the original area,

and the second part is 30% of the original area.

Note that the specified area amounts do not need to sum to 1. For sums less than 1,

the rest of the shape is discarded, and split sections greater than 1 are ignored.

Repeating Split 重复划分


Lot -->
   print("total area = " + geometry.area)
   splitArea(x) { '0.2 : ColorMe }*

ColorMe -->
   case split.index == 0 :
      Red
   case split.index == 1 :
      Yellow
   case split.index == 2 :
      Green
   case split.index == 3 :
      Cyan
   else :
      Blue

This split divides the shape into five equal area parts using a repeat split.

It repeatedly splits the shape into parts with area equal to 20% of the original area.

Note that if area were set to‘0.3,

we would get four parts with areas equal to 30%, 30%, 30%, and 10% of the original area.

Split with Mixture of Floating and Absolute Areas ?分离地块的可变地块和绝对地块


Lot -->
   print("total area = " + geometry.area)	
   splitArea(x) { ~1  : Green
                | 600 : Yellow
                | ~1  : Blue }

This split divides the shape into a middle part (yellow) that has an absolute area of 600 and

two side parts each with the same area.

The yellow part consists of two pieces since there is a hole in the original shape,

and the split cuts the shape along the hole boundary.

Nested Split 嵌套分割


Lot -->
   print("total area = " + geometry.area)	
   splitArea(x) { ~1 : splitArea(z) { '0.5 : Red
                                    | '0.5 : Yellow }
                | ~1 : splitArea(z) { '0.5 : Green
                                    | '0.5 : Cyan }
                | ~1 : splitArea(z) { '0.5 : Blue
                                    | '0.5 : Magenta }
                }

This nested split divides the shape first in x to get three equal area parts.

Then, each part is divided in z into two equal parts. This yields six equal area parts.

adjust vs. noAdjust ?调整方式:noadjust

This is the original shape and its scope.
SplitAdjust –>

splitArea(x) { ‘0.2 : splitArea(z) { ‘0.2 : SplitLeaf }* }*

SplitLeaf–>

color(0.5, 0.5, 0.5) Geometry.

primitiveQuad() t(0, 0.02, 0)

Pink

comp(e) { all : color(0, 0, 0) Edge. }

Without specifying a value for adjustSelector,

the default behavior is to adjust the scope size to the geometry of each split part.

Each pink box shows the scope of each split part.

The scope maintains the original scope’s orientation but shrinks to the bounding box of the geometry.

SplitNoAdjust –>

splitArea(x, noAdjust) { ‘0.2 : splitArea(z, noAdjust) { ‘0.2 : SplitLeaf }* }*

With noAdjust, the union of the scopes of each split part make up the original scope.

The scopes are not adjusted to the geometry inside.

Divide a Block into Equal Parts ?划分为相等的部分

This is the original shape and its scope.

Here is an example of how thesplitArea operation can be used to divide a street block into lots with equal areas.


Lot -->
   SplitArea(3)

SplitArea(n) -->
   case n == 0 :
      A
   case scope.sz > scope.sx :
      splitArea(z) { ~1 : SplitArea(n-1)
                   | ~1 : SplitArea(n-1) }
   else :
      splitArea(x) { ~1 : SplitArea(n-1)
                   | ~1 : SplitArea(n-1) }

A -->
   color(getColor)
   print("area(A) = " + geometry.area)
	
// color by area (so that lots with same area get same color)
const minArea = 243
const maxArea = 1255
alpha = (geometry.area - minArea)/(maxArea - minArea)
getColor = colorRamp("spectrum", alpha)

The block is divided recursively three times using splitArea.

Each split divides the shape perpendicular to its longest axis into two parts of equal area.

Each lot is colored by its area such that lots with the same area have the same color.

Using splitArea, all the lots are yellow because the block is divided into equal area lots.


Lot2 -->
   Split(3)

Split(n) -->
   case n == 0 :
      B
   case scope.sz > scope.sx :
      split(z) { ~1 : Split(n-1)
               | ~1 : Split(n-1) }
   else :
      split(x) { ~1 : Split(n-1)
               | ~1 : Split(n-1) }

B -->
   color(getColor)
   print("area(B) = " + geometry.area)

In comparison, when using the split operation,

the lots are different colors because the block is divided into lots with different areas.



 

 

 

primitiveCone


原生椎体

类型一:primitiveCone()

类型二:primitiveCone(sides)

类型三:primitiveCone(sides,radius,height)

The primitiveCone operation inserts a cone geometry into the scope of the current shape.

  • If no radius and height are given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation.
  • If dimensions are specified the cone is positioned in the xz-center of the scope lying on y=0.

The cone has texture coordinates on the first texture layer (COLORMAP).

参数

  • sides (integer)面数
    Number of subdivisions of the cone surface. There must be at least 3 sides. The default value is 16.
  • radius (float)半径
    Radius of the cone.
  • height (float)高度
    Height of the cone.

实例

primitiveCone01
Lot-->
 primitiveCone()
 color(0,1,0,0.5)
 texture("builtin:uvtest.png")

The inserted cone has 16 sides and is fit into the current scope.

The scope’s zero size is modified relative to the average of the two non-zero sizes.

primitiveCone02
Lot-->
   primitiveCone(8,10,15)
   texture("builtin:uvtest.png")

The inserted cone has 8 sides, a radius of 10, a height of 15 and is positioned in the xz center.

Related

 

 


eyearth保留所有文章所有权


 

primitiveCylinder


原生柱体

类型一:primitiveCylinder()

类型二:primitiveCylinder(sides)

类型三:primitiveCylinder(sides,radius,height)

The primitiveCylinder operation inserts a cylinder geometry into the scope of the current shape.

  • If no radius and height are given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation.
  • If dimensions are specified the cylinder is positioned in the xz-center of the scope lying on y=0.

The cylinder has texture coordinates on the first texture layer (COLORMAP).

参数

  • sides (integer)
    Number of subdivisions of the cylindrical surface. There must be at least 3 sides. The default value is 16.
  • radius (float)
    Radius of the cylinder.
  • height (float)
    Height of the cylinder.

实例

primitiveCylinder01
Lot-->
   primitiveCylinder()
   color(1,0,0,0.5)
   texture("builtin:uvtest.png")

The inserted cylinder has 16 sides and is fit into the current scope.

The scope’s zero size is modified relative to the average of the two non-zero sizes.

primitiveCylinder02
Lot-->
   primitiveCylinder(8,12,10)
   texture("builtin:uvtest.png")

The inserted cylinder has 8 sides, a radius of 10, a height of 15 and is positioned in the xz center.

Related

 

 


eyearth保留所有文章所有权


 

primitiveSphere


原生球

类型一:primitiveSphere()

类型二:primitiveSphere(sides,divisions)

类型三:primitiveSphere(sides,divisions,radius)

The primitiveSphere operation inserts a sphere geometry into the scope of the current shape.

  • If no radius is given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation.
  • If radius is specified the sphere is positioned in the xz-center of the scope lying on y=0.

The sphere has texture coordinates on the first texture layer (COLORMAP).

参数

  • sides (integer)
    Number of subdivisions along latitude of the sphere. There must be at least 3 sides. The default value is 16.
  • divisions (integer)
    Number of subdivisions along longitude of the sphere. There must be at least 2 divisions. The default value is 16.
  • radius (float)
    Radius of the sphere.

实例

primitiveSphere01
Lot-->
   primitiveSphere()
   texture("builtin:uvtest.png")

默认情况下回形成一个纵横,也就是经纬度各划分成16等分的球体。
如果地面时一个正方形形成一个球,如果是长方形会形成一个椭球。

The inserted sphere has 16 sides, 16 divisions and is fit into the current scope.

The scope’s zero size is modified relative to the average of the two non-zero sizes.

primitiveSphere02
Lot-->
   primitiveSphere(8,4,10)
   texture("builtin:uvtest.png")

会按设定好的参数形成一个,八个经度,四个维度划分,半径为10米的球体。

The inserted sphere has 8 sides, 4 divisions, a radius of 10 and is positioned in the xz center.

相关


eyearth保留所有文章所有权


 

primitiveDisk


原生圆形

类型一:primitiveDisk()

类型二:primitiveDisk(nVertices)

类型三:primitiveDisk(nVertices,radius)

The primitiveDisk operation inserts a disk geometry into the scope of the current shape.

  • If no radius is given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation.
  • If radius is specified the disk is positioned in the xz-center of the scope lying on y=0.

If one scope size is zero while the 2 other sizes are not zero the disk will be inserted with respect to the plane defined by the valued scope sizes.

The disk has texture coordinates on the first texture layer (COLORMAP).

参数

  • nVertices (integer)
    Number of vertices at the boundary of the disk. There must be at least 3 vertices. The default value is 16.
  • radius (float)
    Radius of the disk.

实例

primitiveDisk01
Lot-->
 
 rotateScope(0, 0, -45)
 primitiveDisk()
 texture("builtin:uvtest.png")

The inserted disk has 16 vertices and is fit into the current scope xy dimension.

primitiveDisk02
Lot-->
 rotateScope(60, 0, 0) // scope.sz is 0
 primitiveDisk(8,3)
 texture("builtin:uvtest.png")

The inserted disk has 8 vertices, a radius of 10 and is positioned in the xy center.

Related

 

 

 


eyearth保留所有文章所有权

primitiveCube


原生方体

类型一:primitiveCube()

类型二:primitiveCube(width,height,depth)

The primitiveCube operation inserts a cube geometry into the scope of the current shape.

  • If no width, height and depth are given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation.
  • If dimensions are specified the cube is positioned in the xz-center of the scope lying on y=0.

The cube has texture coordinates on the first texture layer (COLORMAP).

参数

  • width (float)
    Width of the cube.
  • height (float)
    Height of the cube.
  • depth (float)
    Depth of the cube.

实例

primitiveCube01
Lot-->
   primitiveCube()
   texture("builtin:uvtest.png")

按着本来地块的大小生成方体	。

The inserted cube is fit into the current scope. The scope’s zero size is modified relative to the average of the two non-zero sizes.

primitiveCube02
Lot-->
   primitiveCube(10,15,20)
   texture("builtin:uvtest.png")
			
按着设定好的长宽高生成方体。

The inserted cube has a width of 10, a height of 15, a depth of 20 and is positioned in the xz center.

Related


eyearth保留所有文章所有权