▼V Reference
52 Find a task or a name
53 Modules to require
54 Scenes and sampling
55 Scene states
56 Animation requests
57 Native model details
58 Visuals
59 Geometry
60 Number Lines and Coordinate Decorations
61 Point Markers, Scatter Plots, and Filled Areas
62 Probability and Statistical Diagrams
63 Calculus lessons
64 Colors
65 Slides
66 Slide command-line tools
67 Source Programs and Authored Timelines
68 Interactive Preview and Inspection
69 Preview controls and diagnostics
70 Projects and Final Rendering
71 Project execution and cache details
72 Pict Renderer Protocol
73 3D reference map
74 3D:   Objects, groups, and paths
75 3D:   Cameras and projection
76 3D:   Views inside a Scene
77 3D:   Animating 3D objects
78 3D:   Animating the 3D camera
79 3D:   Cuts, caps, and section measurements
80 3D:   Supplementary surface, section, and annotation bindings
81 3D:   Cuts, sections, and numerical volume
82 3D:   Vectors
83 3D:   Linear maps and rotations
84 3D:   Affine transforms
85 3D:   Bounds, rays, and planes
86 3D:   Spatial maps and homotopies
87 3D:   Materials and lights
88 3D:   Lighting inspection
89 3D:   Shadow descriptors and stable bounds
90 3D:   Finite-light animation
91 3D:   Software finite-light evaluation
92 3D:   Colour space and final output
93 3D:   Relations and geometric annotations
94 3D:   Projected labels
95 3D:   Textured billboards
96 3D:   Spatial curves and vector diagrams
97 3D:   Spatial anchors and label layout
98 3D:   Anchors and projected labels
99 3D:   Parametric surfaces and calculus
100 3D:   Adaptive, trimmed, and implicit surfaces
101 3D:   Constructive solids
102 3D:   Surface constructors and queries
103 3D:   Meshes
104 3D:   Triangle topology
105 3D:   Polygonal faces
106 3D:   Deterministic convex hulls
107 3D:   Polyhedral duals
108 3D:   Schlegel diagrams and polyhedral nets
109 3D:   Conservative mesh correspondence
110 3D:   Topology-safe mesh matching
111 3D:   Checking and repairing mesh orientation
112 3D:   Clipping, sections, and transparency
113 3D:   Prepared spatial ODE trajectories and vector fields
114 3D:   Seeds and streamline sets
115 3D:   Poincare sections and return maps
116 3D:   Equilibria and local linearization
117 3D:   Flow maps and volume change
118 3D:   Drawing and inspecting trajectories
119 3D:   Reading prepared trajectories
120 3D:   Drawing vector fields and particles
121 3D:   Trajectory display
122 3D:   Spatial inspection and exact picking
123 3D:   Retained renderer backends
124 3D:   Compiled geometry and instances
125 3D:   Frame requests and results
126 3D:   Software rendering and statistics
127 3D:   Optional Racket/  Open  GL backend
128 Experimental Derived Visuals
129 Source Package Hygiene
On this page:
mesh3d
mesh3d?
mesh3d-vertices
mesh3d-triangles
mesh3d-edges
mesh3d-vertex-ids
mesh3d-edge-ids
mesh3d-face-ids
mesh3d-vertex-id
mesh3d-edge-id
mesh3d-face-id
geometry-key3d
mesh3d-geometry-key
mesh3d-semantic-key3d
mesh3d-semantic-key
mesh-part-reference3d
mesh-part-provenance-entry3d
mesh-part-provenance3d
make-mesh-part-provenance3d
mesh-part-provenance3d-source-results
mesh-part-provenance3d-result-sources
9.3

103 3D: Meshes🔗ℹ

3D reference map · First 3D picture

procedure

(mesh3d #:id id    
  #:vertices vertices    
  [#:triangles triangles    
  #:edges edges    
  #:vertex-ids vertex-ids    
  #:edge-ids edge-ids    
  #:face-ids face-ids    
  #:normals normals    
  #:colors colors]    
  #:material material    
  [#:transform transform    
  #:opacity opacity    
  #:wireframe-color color    
  #:wireframe-width width]) → mesh3d?
  id : symbol?
  vertices : vector?
  triangles : vector? = #()
  edges : (or/c #f vector?) = #f
  vertex-ids : (or/c #f vector?) = #f
  edge-ids : (or/c #f vector?) = #f
  face-ids : (or/c #f vector?) = #f
  normals : (or/c #f vector?) = #f
  colors : (or/c #f vector?) = #f
  material : material3d?
  transform : transform3? = identity-transform3
  opacity : (and/c real? (between/c 0 1)) = 1
  color : any/c = "steelblue"
  width : positive-real? = 2
Creates an immutable indexed mesh. Vertices are vec3 values. Triangles are vectors of three valid vertex indices and edges are vectors of two valid indices. Inputs are copied to immutable vectors. When edges is #f, a stable de-duplicated edge list is derived from triangles.

In 'wireframe mode the stable edge order remains visible. In 'opaque mode triangles are flattened in declared order, clipped, depth-tested, and shaded with material. Flat and smooth materials use the declared face or interpolated vertex normals respectively; per-vertex colours are interpolated perspective-correctly. Material, wireframe, and per-vertex colours are color-spec? values, so literals, theme roles, and colour expressions remain part of the immutable mesh and resolve together when a renderer prepares a frame.

Optional semantic ID vectors are immutable vectors of unique symbols, aligned with vertices, edges, and declared triangle faces respectively. They describe author-visible mathematical parts, not GPU geometry. A symbol may appear in more than one kind because the part kind distinguishes it. Omit a vector to use the stable numeric source indices rather than manufacturing names.

procedure

(mesh3d? value) → boolean?

  value : any/c
Recognizes an immutable indexed mesh.

procedure

(mesh3d-vertices mesh) → vector?

  mesh : mesh3d?
Returns immutable vertices.

procedure

(mesh3d-triangles mesh) → vector?

  mesh : mesh3d?
Returns immutable triangle indices.

procedure

(mesh3d-edges mesh) → vector?

  mesh : mesh3d?
Returns immutable wireframe edge indices.

procedure

(mesh3d-vertex-ids mesh) → (or/c #f vector?)

  mesh : mesh3d?
Returns optional immutable semantic vertex IDs.

procedure

(mesh3d-edge-ids mesh) → (or/c #f vector?)

  mesh : mesh3d?
Returns optional immutable semantic edge IDs.

procedure

(mesh3d-face-ids mesh) → (or/c #f vector?)

  mesh : mesh3d?
Returns optional immutable semantic triangle-face IDs.

procedure

(mesh3d-vertex-id mesh index)

 → (or/c symbol? exact-nonnegative-integer?)
  mesh : mesh3d?
  index : exact-nonnegative-integer?
Returns the explicit vertex semantic ID or, if absent, its stable source index.

procedure

(mesh3d-edge-id mesh index)

 → (or/c symbol? exact-nonnegative-integer?)
  mesh : mesh3d?
  index : exact-nonnegative-integer?
Returns the explicit edge semantic ID or, if absent, its stable source index.

procedure

(mesh3d-face-id mesh index)

 → (or/c symbol? exact-nonnegative-integer?)
  mesh : mesh3d?
  index : exact-nonnegative-integer?
Returns the explicit face semantic ID or, if absent, its stable source index.

struct

(struct geometry-key3d (digest
    byte-length
    vertex-count
    triangle-count
    edge-count))
  digest : bytes?
  byte-length : exact-nonnegative-integer?
  vertex-count : exact-nonnegative-integer?
  triangle-count : exact-nonnegative-integer?
  edge-count : exact-nonnegative-integer?
#:transparent]{A renderer geometry identity. It intentionally excludes semantic part IDs.}

procedure

(mesh3d-geometry-key mesh) → geometry-key3d?

  mesh : mesh3d?
Returns the immutable render-geometry key, excluding material, placement, and semantic IDs.

struct

(struct mesh3d-semantic-key3d (geometry
    vertex-ids
    edge-ids
    face-ids
    provenance-schema)
    #:transparent)
  geometry : geometry-key3d?
  vertex-ids : (or/c #f vector?)
  edge-ids : (or/c #f vector?)
  face-ids : (or/c #f vector?)
  provenance-schema : symbol?
An authoring identity layered over geometry.

procedure

(mesh3d-semantic-key mesh) → mesh3d-semantic-key3d?

  mesh : mesh3d?
Returns the immutable semantic key. It is not a renderer cache key.

struct

(struct mesh-part-reference3d (kind id)
    #:transparent)
  kind : (or/c 'vertex 'edge 'face)
  id : any/c
An immutable reference to one source or result mesh part. The kind is explicit so a topology-changing operation can accurately record cross-kind derivation, such as a primal face becoming a dual vertex.

struct

(struct mesh-part-provenance-entry3d (source-part
    result-parts
    relation)
    #:transparent)
  source-part : (or/c #f mesh-part-reference3d?)
  result-parts : vector?
  relation : (or/c 'preserved 'merged 'split 'generated 'discarded 'ambiguous 'derived)
One source-to-result multimap entry. A generated entry has no source; a discarded entry has no result parts.

struct

(struct mesh-part-provenance3d (vertices edges faces warnings)
    #:transparent)
  vertices : vector?
  edges : vector?
  faces : vector?
  warnings : vector?
Shared immutable provenance for a topology-changing mesh operation. Entries are grouped by source part kind; warnings document intentional identity loss or ambiguity.

procedure

(make-mesh-part-provenance3d [#:vertices vertices 
  #:edges edges 
  #:faces faces 
  #:warnings warnings]) 
 → mesh-part-provenance3d?
  vertices : vector? = #()
  edges : vector? = #()
  faces : vector? = #()
  warnings : vector? = #()
Builds a validated provenance value.

procedure

(mesh-part-provenance3d-source-results provenance 
  source) 
 → (or/c #f vector?)
  provenance : mesh-part-provenance3d?
  source : mesh-part-reference3d?
Looks up one source part’s zero, one, or many result parts.

procedure

(mesh-part-provenance3d-result-sources provenance    
  result) → vector?
  provenance : mesh-part-provenance3d?
  result : mesh-part-reference3d?
Returns every source part that contributes to the specified result part.