Details and Options
ResourceFunction["CuboidalFlange3D"] can be used in
Graphics3D.
ResourceFunction["CuboidalFlange3D"] in general returns a (possibly large and nested) list of graphics primitives such as
Cuboid or
BSplineSurface that together constitute a flange.
ResourceFunction["CuboidalFlange3D"] is intended as a convenience function that allows for easy creation of composed cube-like graphics objects with textual labels. Its purpose is purely visual, and no computation with the output (such as
RegionMeasure) is supported.
The first argument specifies the shape and size of the main graphics object, the second argument specifies the position and shape of protrusions.
First argument can be of the following forms:
Automatic | default shape is set to "Cuboid" |
shapename | string specifying the shape, see below |
{shapename,hlen} | specify half the length of the body (default is 1) |
{shapename,hw,hlen} | specify half the width and height (default is 1) |
{shapename,hw,hh,hlen} | specify half the heigth separately from the width (default is 1) |
{shapename,hw,hh,hlen,pars} | specify additional parameters such as rounding radii (if any exist) |
Parameter shapename can be of the following forms:
"Cuboid" | object given by Cuboid |
"RoundedCuboid" | object given by ResourceFunction["RoundedCuboid"] |
"RoundedFrame3D" | object given by ResourceFunction["RoundedFrame3D"] |
"Empty" | no object created |
fun[hw,hh,hlen,pars] | object generated by a pure function |
For named shapes, the input parameters are checked for whether they lie in the allowed range. When a pure function is supplied, no parameter preprocessing is performed.
Second argument can be of the following forms:
num | number of evenly distributed protrusions on the front face |
posspec | list of protrusion positions specified in the plane of the front face |
{posspec,shapespec} | positions as well as the shape of the protrusions, see below |
{spec1,spec2,…} | list of as many as six specifications for individual faces, each of which is of any of the forms in the previous lines |
<|k1→spec1,k2→spec2,…|> | Association where keys specify the positions of faces to which the specifications apply |
When the second argument is specified as an
Association, it can be of two distinct forms:
<|num1→spec1,num2→spec2,…|> | specify faces based on their numerical index, e.g. <|3→{2,"Cylinder"},5→5|> creates two cylindrical protrusions on the third face and five cuboidal protrusions on the fifth face |
<|Left→spec1,Right→spec2,…|> | specify faces based on their relative position, the example above would correspond to <|Above→{2,"Cylinder"},Right→5|> |
The position specification posspec for protrusions can have the following forms:
num | non-negative number of protrusions, evenly distributed on the face |
{{x1,y1},{x2,y2},…} | list of Cartesian coordinates for individual protrusions |
{{x1,y1,em1},{x2,y2,em2},…} | together with the position also specify for each protrusion how much it should protrude from the surface |
The Cartesian coordinates are relative with 0 correspoding to the center, 1 for one corner of the main body, and -1 for the opposite corner. The third coordinate characterizes how much the protrusion sinks into the surface or protrudes from it.
The shape specification shapespec for protrusions follows exactly the shape specification for the main body with the only difference that the second parameter corresponds to the full length, not just half the length. The allowed shapes are, also, slightly different:
The following full specifications for each shape are allowed:
{"Cylinder",rad,hlen} | cylinder of half-length hlen and radius rad |
{"RoundedCylinder",rad,hlen,rrad} | rounded cylinder with rounding radius rrad |
{"Annulus3D",rad,hlen,inrad} | 3D annulus with inner radius inrad |
{"RoundedAnnulus3D",rad,hlen,inrad,rrad} | rounded 3D annulus with inner radius inrad and rounding radius rrad |
{"Empty",hx,hy,hz} | empty cuboid-like object of given dimensions |
{"Cuboid",hx,hy,hz} | cuboid with half-width hx, half-depth hy, and half-length hz |
{"RoundedCuboid",hx,hy,hz,rrad} | rounded cuboid with rounding radius rrad |
{"RoundedFrame3D",hx,hy,hz,tx,ty,rrad} | rounded 3D frame with thicknesses tx and ty, and with rounding radius rrad |
When only a partial shape specification is given, default values are used instead. The default value for hx, hy, and hz is 1 for the main body and 0.1 for protrusions. Additional parameters are dynamically calculated from the values of hx, hy, and hz (if not supplied explicitly). The thicknesses tx and ty for "RoundedFrame3D" are set to 0.3hx and 0.3hy, respectively. The inner radius inrad and rounding radius rrad are set to 0.5hx and 0.01hx, respectively. For "Cylinder", "RoundedCylinder", "Annulus3D", and "RoundedAnnulus3D" rad is set to hx, while hlen is set to hz. Also, for protrusions the value of hz (or hlen) corresponds to the entire length, whereas for the main body it is only half the length.
The following options can be given:
"Label" | None | textual label(s) on the main object |
RasterSize | 200 | raster size of each label |
"RotateProtrusions" | Automatic | whether to rotate the protrusions |
Textual labels specified by "Label" are represented as rasterized images wrapped in
Texture that spans a
Polygon.
The "Label" setting can have the following forms:
None | Automatic | no label |
"SomeText…" | textual label on the front face |
Style[stylespec] | text wrapped in Style |
{textspec,scale} | specify also a scale (default scale is 1) |
{textspec,scale,orientation} | specify orientation (can be any real number, default is 0) |
{labspec1,labspec2,…} | specify labels for individual faces, not just the front face |
<|k1→labspec1,k2→labspec2,…|> | specify for specific faces, the form of keys is the same as for protrusions |
The
RasterSize setting can have the following forms:
num | the same size for all labels |
{num1,num2,…} | specify sizes for each label |
<|k1→num1,k2→num2,…|> | specify sizes for specific labels, the form of keys is the same as for protrusions |
The "RotateProtrusions" setting can have the following forms:
True|False | specify whether the protrusions are rotated for all faces |
Automatic | equivalent to False for types "Cylinder", "RoundedCylinder", "Annulus3D", and "RoundedAnnulus3D", and to True otherwise (default) |
{rotspec1,rotspec2,…} | specify individually for each face |
<|k1→rotspec1,k2→rotspec2,…|> | specify for specific faces, the form of keys is the same as for protrusions |
When "RotateProtrusions" is active, the protrusions for a given face are rotated in such a way that they point to the center of the face.