sf
sf projects the vertices, edges and faces of a region onto a surface, so that the mesh follows real geometry.
Syntax
sf imin jmin kmin imax jmax kmax sd surface
sf imin jmin kmin imax jmax kmax kind parameters
The first six numbers are a region, as for lin. The region must be a vertex, an edge or a face.
The surface is either a reference or an inline definition:
sd surfacenames a surface that sd defines, by its number or its name.kind parametersdefines the surface on the spot, with the same kinds and the same parameters assd:
plan x0 y0 z0 xn yn zn
cy x0 y0 z0 xn yn zn radius
sp x0 y0 z0 radius
cone x0 y0 z0 xn yn zn radius angle
crx curve
cry curve
crz curve
sds surface_1 surface_2 ... ;
cyli is another spelling of cy, and sphe of sp. The sd page explains each parameter.
What it does
James moves each node of the region to the nearest point of the surface. The projection stays in force: when a later step moves the node, James projects it again. A node that several commands constrain is projected onto all of its surfaces at once.
- One surface: the node goes to the nearest point of that surface.
- Two surfaces: the node goes to a point on both, which lies on the curve where they cross.
- Three surfaces: the node goes to the point where all three meet.
The shaping chapter explains projection, including where a face projected onto a sphere bulges.
When James applies it
A vertex is projected at step 3, the nodes of an edge at step 6 and the nodes of a face at step 9. A region that is an edge is therefore stored for steps 3 and 6, and a region that is a face for steps 3, 6 and 9. sf is legal only in the Part phase. James refuses it in the Control and Merge phases (E0412).
Rules James adds
- A region that is a block is an error (E0807). Projecting a solid has no meaning, so James asks you to name its faces.
- A node may carry at most three surfaces (E0803). James counts the distinct surfaces that reach one vertex, in the order of the commands. A composite from
sdscounts as one. James reports the first vertex that reaches four, once per part. - An inline surface that you repeat is a second surface. James does not recognise a repeat. To reuse a surface, define it once with
sdand name it. sd nameselects the surface with that name. If several surfaces share the same first eight characters, ignoring case, James uses the composite of all of them, and the composite counts as one surface.- A surface kind that James knows of but does not support is an error (E0801). A word that is no surface kind at all is E0104. A surface number or name that nothing defines is an error (E0800), which James reports when the part ends, because an
sdmay follow thesf. A baresdwith nothing after it is E0104. - A projection that cannot be solved stops the run with an error that names the node and the part. A node at the centre of a sphere is the usual case: every point of the sphere is equally near. James never turns such a failure into a warning.
Diagnostics
- E0800: the surface number or name is not defined.
- E0801: the inline surface kind is not supported.
- E0803: a node would carry more than three surfaces.
- E0807: the region is a block.
- E0102: a reduced index lies outside the part.
- E0106: a range of the region is written high to low.
Example
The script tests/corpus/066-sf-two-surface-intersection/input.tg, which make test runs:
sd 1 plan 0 0 0 0 0 1
sd 2 plan 0 0 0 1 0 0
block 1 2 3;1 2 3;1 2 3; 0 1 2; 0 1 2; 0 1 2;
sf 1 1 1 1 3 1 sd 1
sf 1 1 1 1 3 1 sd 2
endpart
The two sd commands define the plane z = 0 and the plane x = 0. Both sf commands name the edge 1 1 1 1 3 1, which runs along j on the line where the planes cross, so every node of the edge carries two surfaces. The edge already lies on both planes, so nothing moves. The IR holds two sf rows, each with steps [3 6].
See also
- sfi: the same command with an index progression.
- sd: defines the surfaces that
sfrefers to. - ms: projects one face per index onto a sequence of surfaces.
- Shaping a part: how projection and interpolation combine.