Editing BRL-CAD Primitives

From BRL-CAD

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
 +
{{stub}}
 
[[category:MGED| Primitives]]
 
[[category:MGED| Primitives]]
  
This article provides an overview of various types of geometric primitive objects that can be added to a BRL-CAD geometry file. The shape, size, location and orientation of each such object are defined by a set of parameters/properties that are specific to its type, which are discussed in the corresponding section below.
+
These are primitive objects that can be created in mged.
  
For general discussions on using MGED to create primitive objects, view their properties, and modify or move them, see:
+
Objects can be created in any of the following ways:  (note: are there more? get? load from file?)
* [[Creating_primitive_objects]]
+
;make : the mged make command creates the object with default dimensions
* [[Determining_the_properties_of_primitive objects]]
+
;in : the mged in command interactively prompts for dimensions not already supplied as arguments
* [[Changing_the_properties_of_primitive objects]]
+
;form :the graphical primitive editor form (* some objects not fully supported)
 +
;create : the graphical create menu
  
also see:
+
When an object is selected from the create menu, you are prompted for a name, and then dropped into the primitive editor form; however, if the objec type has no form, create will do about the same as make.  Some derivative objects do not have their own form, and the primitive editor will use the base object's form.  Most parameters  (including ones not editable from a form) have special items on the edit menu.
* [[A Survey of Implicit Constraints in Primitives]]
 
;
 
  
= Arbitrary convex polyhedra =
+
=Arbs=
 +
Objects with an arbitrary number of points and flat faces...
 +
==arb8==
 +
Arbitrary straight-edged shape with 8 vertices.
  
An '''arbitrary convex polyhedron''' ('''arb''') is a geometric volume that is completely enclosed by a set of 3-dimensional planes. Each has a set of straight-edged, flat '''faces''' outlined by the intersections of those planes. The intersection of each pair of planes is a line whose intersections with other planes defines a pair of '''vertices'''. The line segment between those two vertices is an '''edge''' of the polyhedron that is shared by two faces. Each vertex is common to an equal number (at least three) of faces and edges.
+
;Handled by: make in form create
 +
;Arguments: 8 Vertices in the following order: 1234 vertices for the front face, starting at bottom left, counterclockwise; then 5678 vertices for the rear face, starting at bottom left, counterclockwise.
 +
;Example:
 +
in unitcube.s arb8  0 0 0  1 0 0  1 0 1  0 0 1  0 1 0  1 1 0  1 1 1  0 1 1
 +
creates the unit cube (first vertex at the origin, extends for 1 unit in x, y and z direction).
  
For example, a rectangular parallelepiped is enclosed by three orthagonal pairs of parallel planes. Their intersections define six faces, each with four edges and four vertices. There are a total of 12 edges (each shared by two faces) and 8 vertices (each shared by three faces and three edges).
+
== arb7 ==
 +
Special case of arb8, except with point 8 merged into point 5, making the left face triangular
 +
;Handled by: make in form(arb8) create
 +
== arb6 ==
 +
Arbitrary straight-edged shape with 6 vertices, special case of arb8.
 +
;Handled by: make in form(arb8) create
 +
;Arguments: 6 Vertices in the following order: 1234 vertices for the front face, starting at bottom left, counterclockwise; then back edge is 5 on bottom, 6 on top.  Top and bottom faces are triangles.
 +
;Example:
  
The BRL-CAD geometry file format defines two types of records for such polyhedra:
+
in arb6.s arb6 1 -1 -1  1 1 -1  1 1 1  1 -1 1  -1 0 -1  -1 0 1
* [[#ARB8 Records|'''arb8'''s]] are specified by a set of eight vertices.
 
* [[#ARBN Records|'''arbn'''s]] are specified by a set of intersecting planes, each defined by four coefficients.
 
  
Although any polyhedron can be defined and stored as an arbn, the arb8 record type is more commonly employed because it is simpler to work with and still accommodates most constructive solid geometry applications.
+
== arb5 ==
 +
special case of arb8.
 +
;Handled by: make in form(arb8) create
 +
== arb4 ==
 +
special case of arb8.
 +
;Handled by: make in form(arb8) create
 +
== arbn ==
 +
Arbitrary solid bounded by N planes
 +
;Handled by: make in create
 +
;Arguments:
 +
;; Number of planes
 +
;; xyz direction vector and normal for each plane
  
== ARB8 Records ==
+
;Example:
 +
in arbn.s arbn 8  1 0 1 1  -1 0 0 1  0 1 0 1  0 -1 0 1  0 0 1 1  0 0 -1 1  0.5 0.5 0.5 1  -0.5 -0.5 -0.5 1
  
An '''arb8''' record is specified by a set of eight {X, Y, Z} vertices designated V1 through V8, which need not all be unique. BRL-CAD uses such records to represent polyhedra having four, five or six faces:
+
==box==
 
+
Special case of arb8
* '''arb8''' shapes have eight unique vertices. They represent '''hexahedra''' that have six quadrilateral faces sharing eight edges. In addition to simply specifying the {X, Y, Z} coordinates of those vertices, MGED provides easier ways to create the following specific types of hexahedra:
+
;Handled by: in form(arb8)
** '''3ptarb''' shapes represent '''right quadrilateral prisms''', which are extruded quadrilaterals having parallel ends connected by four rectangular sides.
+
;Arguments:
** '''box''' shapes represent '''parallelepipeds''', whose faces comprise three pairs of equal parallelograms. Unlike a common box, those faces need not be rectangular—if they are, the enclosed volume is a rectangular parallelepiped.
+
;;V : vertex of first corner
** '''rpp''' shapes represent '''rectangular parallelepipeds''' (also known as '''cuboids''' and '''rectangular prisms'''), whose faces comprise three pairs of equal rectangles. If one pair of faces are squares, the volume is a '''square prism'''. If all of them are squares, the volume is a '''cube''' (geometrically, there cannot be just two pairs of square faces).
+
;;direction vectors for height, width, and depth
 
+
==rpp==
* '''arb7''' shapes have seven unique vertices. They represent hexahedra that have four quadrilateral and two triangular faces sharing eleven edges. They can only be created by specifying the {X, Y, Z} coordinates of those vertices.
+
Special case of arb8
 
+
;Handled by: make in form(arb8) create
* '''arb6''' shapes have six unique vertices. They represent '''triangular prisms''' and '''truncated tetrahedra''', which are '''pentahedra''' that have two triangular ends connected by three quadrilateral sides sharing nine edges. In addition to simply specifying the {X, Y, Z} coordinates of their vertices, MGED provides an easier way to create one specific type of hexahedron:
+
;Arguments: xmin xmax ymin ymax zmin zmax
** '''raw''' ('''right angle wedge''') shapes are '''triangular prisms''' whose ends are parallel to each other. Interestingly enough, they don't seem to require any right angles. If the ends are perpendicular to the connecting edges, the shape is a '''right triangular prism''' and has rectangular sides. Presumably two of the rectangular sides of an actual right-angle wedge would also be perpendicular to each other.
 
 
 
* '''arb5''' shapes have five unique vertices. They represent '''quadrahedra''', which are pentahedra that have a quadrilateral base and four triangular sides sharing eight edges. If such a volume has a rectangular base it is a '''rectangular pyramid''', one with a square base is a '''square pyramid'''.
 
 
 
* '''arb4''' shapes have four unique vertices. They represent '''tetrahedra''', which have four triangular faces sharing six edges. If all four triangles are equilateral, the shape is a '''regular tetrahedron'''.
 
 
 
== ARBN Records ==
 
 
 
An '''arbn''' record is specified by N sets of intersecting planes, each defined by four coefficients:
 
* the {X, Y, Z} coefficients of the plane's normal vector pointing outward from the center of the arbn shape, and
 
* the perpendicular distance of that plane from the origin.
 
As discussed in the [[Creating and editing arbn primitives]] article, BRL-CAD uses such primitives to represent polyhedra having any number of sides, edges and vertices.
 
  
 
=Ellipsoids=
 
=Ellipsoids=
Line 69: Line 81:
 
;Handled by: in form(ell)  
 
;Handled by: in form(ell)  
 
;Arguments: two foci points, and axis length
 
;Arguments: two foci points, and axis length
==ell1==
 
Special case of ellipsoid
 
;Handled by: in make form(ell) create
 
;Arguments: vertex, vector A, radius of revolution
 
 
==ehy==
 
==ehy==
 
Elliptical hyperboloid
 
Elliptical hyperboloid
 
;Handled by: make in form create
 
;Handled by: make in form create
 
;Arguments: vertex, perpendicular vectors Height and (A,r_1) major axis, (r_2) magnitude of vector B, (c) apex to asymptotes distance
 
;Arguments: vertex, perpendicular vectors Height and (A,r_1) major axis, (r_2) magnitude of vector B, (c) apex to asymptotes distance
 +
==ell1==
 +
Special case of ellipsoid
 +
;Handled by: in make form(ell) create
  
 
==epa==
 
==epa==
Line 86: Line 97:
 
Truncated general cone
 
Truncated general cone
 
;Handled by: in make form create
 
;Handled by: in make form create
;Arguments: vertex, vectors H A B, magnitudes of vectors C D
+
;Arguments:
 
 
 
== rcc ==
 
== rcc ==
 
Right circular cylinder, special case of tgc
 
Right circular cylinder, special case of tgc
 
;Handled by: in make form(tgc) create
 
;Handled by: in make form(tgc) create
;Arguments: vertex, height vector, radius
+
;Arguments: vertex ,  
Example:
 
  in rcc1.s rcc 0 0 0  1 1 1  0.5
 
 
 
 
== rec ==
 
== rec ==
 
Right elliptical cylinder, special case of tgc
 
Right elliptical cylinder, special case of tgc
Line 112: Line 119:
 
;Arguments: Vertex, vectors Height, A, B
 
;Arguments: Vertex, vectors Height, A, B
 
== trc ==
 
== trc ==
Truncated right circular cone, special case of tgc
+
Truncated right cone
 
;Handled by: in make form(tgc) create
 
;Handled by: in make form(tgc) create
 
;Arguments: Vertex, Height vector, radius of base and top
 
;Arguments: Vertex, Height vector, radius of base and top
 +
=Other=
  
= derived from 2d=
+
==grip ==
==extrude==
+
Grip
Extrusion of a 2-d sketch
+
;Handled by: in make form create
;Handled by: in make form(?) create
+
Arguments:
;Arguments: vertex, perpendicular vectors Height A B, sketch, K
+
;C : Center
 
+
;N : normal vector
==revolve==
+
;L : magnitude
Revolution of a 2-d sketch
 
;Handled by: in
 
;Arguments: vertex, revolution axis, vector in start plane, angle, sketch
 
 
 
==dsp==
 
;Handled by: in create
 
;Arguments: data type (f|o), datasource, count of length and width, interpolation type, cut direction, cell size, unit elevation
 
 
 
See also [[DSP]] tutorial.
 
 
 
==ebm==
 
extruded bit map
 
;Handled by: in form create
 
;Arguments: filename, width and height in cells, extrusion distance,
 
 
 
See also [[EBM]] tutorial.
 
 
 
The extruded bitmap (also referred to as EBM) is a solid based on a greyscale bitmap. The bitmap is an array of unsigned char values, see bw(5), and is extruded by some distance. The EBM solid requires the dimensions of the bitmap file (height and width in bytes), an extrusion length, and a transformation matrix to position the EBM. Each byte in the bitmap file is treated as the base of a cell that is extruded by the specified extrusion length. If the value of the byte is non­zero, then that cell is considered solid.
 
 
 
==hf==
 
Height field
 
;Handled by: none?
 
;Status: depreciated, use dsp instead
 
 
 
 
 
=Other solids=
 
  
 
== tor ==
 
== tor ==
Line 158: Line 140:
 
;Handled by: in make form create
 
;Handled by: in make form create
 
;Arguments: vertex, normal vector, radius of revolution, vector C, (r_d) magnitude of semi-minor axis
 
;Arguments: vertex, normal vector, radius of revolution, vector C, (r_d) magnitude of semi-minor axis
 
+
== half ==
 +
halfspace
 +
;Handled by: in make form create
 +
;Arguments: Normal, distance from origin
 
== part ==
 
== part ==
 
Conical particle
 
Conical particle
 
;Handled by: in make create
 
;Handled by: in make create
 
;Arguments: vertex, height vector, radius at v, radius at h
 
;Arguments: vertex, height vector, radius at v, radius at h
The particle solid is a lozenge-shaped object defined by a vertex, a height vector and radii at both ends. The body of the particle is either a cylinder or a truncated cone, depending on the values of the radii. Each end of the particle is a hemisphere of the specified radius.
 
 
 
== nmg ==
 
== nmg ==
n-Manifold geometry solid (non-manifold geometry)
+
n-Manifold geometry solid
 
;Handled by:  make create
 
;Handled by:  make create
 
 
== pipe ==
 
== pipe ==
Hollow and solid pipes and wires
 
 
;Handled by: in make create
 
;Handled by: in make create
 
;Arguments: # points, for each point: location, inner and outer diameters, bend radius
 
;Arguments: # points, for each point: location, inner and outer diameters, bend radius
Line 209: Line 190:
 
1 0 -3 0 -1 -3 -1 0 -3 0 1 -3 : a 2x2 square at a 45 degree rotation from the first squares at z offset -3<br>
 
1 0 -3 0 -1 -3 -1 0 -3 0 1 -3 : a 2x2 square at a 45 degree rotation from the first squares at z offset -3<br>
 
0 0 -3 : the center of the bottom end of the bar
 
0 0 -3 : the center of the bottom end of the bar
 
==metaball==
 
;Handled by: in make form(*) create
 
;Arguments: render method, threshold, number of points, location and field strength for each point (and blobbiness/goo factor)
 
 
 
==brep==
 
[[NURBS|see NURBS]]
 
 
==spline==
 
surface splines
 
;Handled by: ?
 
 
==vol==
 
volume / voxel
 
; Handled by: in
 
; Arguments: filename, xyz dimensions of file (in voxels), lower and upper threasholds, xyz dimensions of a cell
 
The vol solid is defined by a 3-dimensional array of unsigned char values. The solid requires a file of these values, the extent of the file (in bytes) in each dimension, the size of each cell, and high and low thresholds. Any value in the file that is between the thresholds (inclusive) represents a solid cell.
 
 
==bot==
 
Bag of triangles
 
;Handled by: in make create (not edit!)
 
;Arguments: number of verticies, number of triangles, mode (1=surface 2=solid 3=plate), triangle orientation mode (1=unoriented 2=counter-clockwise 3=clockwise), each vertex, vertex index of each triangle
 
;See also: [[BoT]]
 
 
==poly==
 
polysolid
 
; Handled by: none?
 
; Status: depreciated, use bot instead
 
 
=Other=
 
==Sketch==
 
2d outline
 
;Handled by: make form(sketch editor) create
 
;See also: [[sketch]]
 
 
==annot==
 
2D annotation primitive
 
;Handled by: in command
 
See: [[annot]]
 
 
==grip ==
 
Grip -- support for joints, non-geometric (does not show in rt)
 
;Handled by: in make form create
 
Arguments:
 
;C : Center
 
;N : normal vector
 
;L : magnitude
 
 
== half ==
 
halfspace
 
;Handled by: in make form create
 
;Arguments: Normal, distance from origin
 
A half space is the portion of space on one side of a plane. It is represented by its boundary (the plane) and its outward-pointing normal vector.
 
==binunif==
 
Uniform-array binary object
 
;Handled by: in create (not edit!)
 
;Arguments: minor type (fdcsiLCSIL), data file, number of values
 
 
== submodel ==
 
Instanced Submodel
 
:Handled by: in make form create
 
:Arguments:
 
;file: File holding the referenced geometry. 0-length if geometry is in the same file.
 
;treetop: Single name for the geometry to reference.
 
A submodel is a reference to another geometry, possibly in a separate file.
 

Please note that all contributions to BRL-CAD may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BRL-CAD:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)