Home> 4D Blocks > Version 3 Controls Settings Examples > Scene Language Kinds of Blocks Goals History Versions Constants
|
Geometry CommandsStandard BlocksThe simplest command is just the name of a type of block, which creates a new block of that type at its default location (which should typically have coordinates ranging from 0 to 1). For example ...
block3 Here's a partial list of predefined block types from the files "library" and "library2". For a complete list look in the files, they're easy to read.
block3 Geometric Operations All of these leave the updated shape on the stack afterward. translate When you have more than one block, you'll want them to be in different places. Here's how you create a block3 that's moved one unit in the x direction (i.e. to the right).
block3 [1 0 0] translate shapecolor You can change the colors of blocks using the color constants listed in Constants or using the same kinds of colors as in HTML. The color operation can come before or after translation, doesn't matter.
block3 red shapecolor facecolor You can change the colors of individual faces too. Faces are identified by numbers from 0 to N-1. You can figure out which faces are which by experimenting or by digging into the library file where they're defined.
block3 5 red facecolor glass You can turn a block into glass so that it's transparent. For the moment this also lets you fly through the block.
block3 glass scale You can stretch blocks by different amounts in different directions. Be sure to use one number per dimension, and to use 1 not 0 for directions with no stretching!
block3 [2 1 1] scale The scaling is relative to the origin of the coordinate system, not the shape center, so you may need to apply some translation afterward. rotate, altrot shape dir1 dir2 theta rotate - Rotate the shape by theta degrees in the direction that takes dir1 toward dir2. The center of rotation is the shape's center but the direction of rotation is defined in terms of absolute coordinates, not the shape's internal axes. The direction constants "x+" to "w-" are discussed in Constants. The alternate rotation command "altrot" allows you to rotate around an arbitrary point. The extra position argument comes after theta. edge, face, shape, def If you want to get into defining new block types, see the "library" file for examples. Here are a few hints about the format.
Advanced Shape-Building Commands polygon, altpoly [x y] r n polygon - This constructs a n-sided polygon of radius r around (x,y). The polygon is a two-dimensional shape, so you'll have to use one of the following three commands to add more dimensions. If you try to display it directly, who knows what will happen. The alternate command "altpoly" does the same thing but with the faces shifted. This is mainly useful for getting axis-aligned edges on polygons where the number of sides is a multiple of 4. prism shape axis [min max] prism - This takes the given shape and adds a dimension to it to make a prism. The prism extends from min to max along the given axis. As a combined example, these commands create a hovering nine-sided prism.
[1 1] 1 9 polygon y [1 3] prism cone shape point axis [min tip] cone - This takes the given shape and adds a dimension to it to make a cone. The cone extends from min to tip along the given axis. The given point has the same dimensionality as the starting shape and tells where in that plane the tip of the cone should be. So, you can make symmetrical or asymmetrical cones. frustum shape point axis [min max tip] frustum - This takes a cone that extends from min to tip and cuts it off at max to make a frustum.
|