Round the mug's foot and its handle, and let an arc bar carry a section with more than four sides.
This commit is contained in:
parent
9ab88aa633
commit
e0a315a43f
2 changed files with 68 additions and 16 deletions
|
|
@ -60,7 +60,7 @@ export interface CoffeeMugConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const coffeeMugDefaults: CoffeeMugConfig = {
|
export const coffeeMugDefaults: CoffeeMugConfig = {
|
||||||
height: 0.095,
|
height: 0.1,
|
||||||
radius: 0.041,
|
radius: 0.041,
|
||||||
// A slight taper. Dead straight is a value in the family, not the default:
|
// A slight taper. Dead straight is a value in the family, not the default:
|
||||||
// most mugs narrow a little toward the foot and it keeps the silhouette
|
// most mugs narrow a little toward the foot and it keeps the silhouette
|
||||||
|
|
@ -106,16 +106,29 @@ export function createModel(overrides: Partial<CoffeeMugConfig> = {}) {
|
||||||
// One profile, up the outside, over the rim, down the bore. A single
|
// One profile, up the outside, over the rim, down the bore. A single
|
||||||
// lathe leaves no coincident faces where an outer and an inner shell
|
// lathe leaves no coincident faces where an outer and an inner shell
|
||||||
// would meet, and the rim thickness falls out of the turn-around.
|
// would meet, and the rim thickness falls out of the turn-around.
|
||||||
|
// The foot's corner radius. A fifth of the mug's radius, which is what
|
||||||
|
// the reference measures and is generous next to anything turned.
|
||||||
|
const foot = R * 0.2
|
||||||
const half = wall / 2
|
const half = wall / 2
|
||||||
const rimY = H - half
|
const rimY = H - half
|
||||||
const rimX = R - half
|
const rimX = R - half
|
||||||
const s45 = half * Math.SQRT1_2
|
const s45 = half * Math.SQRT1_2
|
||||||
const levels: Level[] = [
|
const levels: Level[] = [
|
||||||
// A short chamfer off the table, so the foot has an edge that reads
|
/**
|
||||||
// as trimmed rather than the wall dying into the ground plane.
|
* A ROUNDED foot, not a chamfer.
|
||||||
{ y: 0, radius: F * 0.96 },
|
*
|
||||||
{ y: 0.0035, radius: rOut(0.0035) },
|
* The 3.5 mm bevel that was here read as a trimmed edge, which is
|
||||||
{ y: H * 0.2, radius: rOut(H * 0.2) },
|
* what a thrown pot has and what a slip-cast mug does not: the
|
||||||
|
* reference turns the corner over about a fifth of the radius and
|
||||||
|
* that soft corner is most of why it reads as a mug rather than as a
|
||||||
|
* tube with a lid missing. Sampled at 30 and 60 degrees so the
|
||||||
|
* smoothing takes it as one curve.
|
||||||
|
*/
|
||||||
|
{ y: 0, radius: F - foot },
|
||||||
|
{ y: foot * 0.134, radius: F - foot * 0.5 },
|
||||||
|
{ y: foot * 0.5, radius: F - foot * 0.134 },
|
||||||
|
{ y: foot, radius: rOut(foot) },
|
||||||
|
{ y: H * 0.3, radius: rOut(H * 0.3) },
|
||||||
{ y: H * 0.45, radius: rOut(H * 0.45) },
|
{ y: H * 0.45, radius: rOut(H * 0.45) },
|
||||||
{ y: H * 0.7, radius: rOut(H * 0.7) },
|
{ y: H * 0.7, radius: rOut(H * 0.7) },
|
||||||
{ y: H * 0.88, radius: rOut(H * 0.88) },
|
{ y: H * 0.88, radius: rOut(H * 0.88) },
|
||||||
|
|
@ -148,11 +161,19 @@ export function createModel(overrides: Partial<CoffeeMugConfig> = {}) {
|
||||||
)
|
)
|
||||||
|
|
||||||
/* ----------------------------------------------------------- handle */
|
/* ----------------------------------------------------------- handle */
|
||||||
// Strap section: deeper across (z, along the wall) than radially. Built
|
/**
|
||||||
// square by arcBarGeometry, flattened by a scale before it moves.
|
* Strap section: nearly square, and DEEPER in the plane of the loop.
|
||||||
|
*
|
||||||
|
* It was the other way round, 11.5 mm across the wall against 6 mm
|
||||||
|
* radially, so the widest face of the handle was the one turned toward
|
||||||
|
* anyone looking at the mug from the side. That is a ribbon, and a
|
||||||
|
* handle you could not get a finger round. A real one is close to
|
||||||
|
* square and if anything deeper the way the loop runs, because that is
|
||||||
|
* the direction it has to be stiff in.
|
||||||
|
*/
|
||||||
const scaleT = R / 0.041
|
const scaleT = R / 0.041
|
||||||
const tRad = Math.min(0.0072, Math.max(0.0048, 0.006 * scaleT))
|
const tRad = Math.min(0.0098, Math.max(0.0062, 0.0082 * scaleT))
|
||||||
const widthZ = Math.min(0.0135, Math.max(0.0088, 0.0115 * scaleT))
|
const widthZ = Math.min(0.0092, Math.max(0.0058, 0.0074 * scaleT))
|
||||||
|
|
||||||
// Where the loop leaves the wall.
|
// Where the loop leaves the wall.
|
||||||
const topY = H * 0.78
|
const topY = H * 0.78
|
||||||
|
|
@ -187,11 +208,15 @@ export function createModel(overrides: Partial<CoffeeMugConfig> = {}) {
|
||||||
// body both ends sit at the same depth instead of one floating proud.
|
// body both ends sit at the same depth instead of one floating proud.
|
||||||
const alpha = Math.atan2(-chordX, chordY)
|
const alpha = Math.atan2(-chordX, chordY)
|
||||||
|
|
||||||
|
// Twelve-sided, so the loop has no hard edge running its length. A
|
||||||
|
// square strap's four corners catch light as ridges and no amount of
|
||||||
|
// getting the proportions right stops that reading as a folded ribbon.
|
||||||
const strap = arcBarGeometry(
|
const strap = arcBarGeometry(
|
||||||
rLoop, tRad, -thetaE, thetaE, 22, [0, 0, 0],
|
rLoop, tRad, -thetaE, thetaE, 22, [0, 0, 0],
|
||||||
// The body's own glaze colour: a handle tinted separately shows the
|
// The body's own glaze colour: a handle tinted separately shows the
|
||||||
// join as a colour edge before it shows it as geometry.
|
// join as a colour edge before it shows it as geometry.
|
||||||
glaze.clone(),
|
glaze.clone(),
|
||||||
|
12,
|
||||||
)
|
)
|
||||||
// Flatten to a strap, tilt to the wall, then carry to the wall. Built
|
// Flatten to a strap, tilt to the wall, then carry to the wall. Built
|
||||||
// at the origin in the XY plane, which is already the vertical plane
|
// at the origin in the XY plane, which is already the vertical plane
|
||||||
|
|
|
||||||
|
|
@ -504,6 +504,18 @@ export function arcBarGeometry(
|
||||||
segments: number,
|
segments: number,
|
||||||
centre: Vec3,
|
centre: Vec3,
|
||||||
colour: Color,
|
colour: Color,
|
||||||
|
/**
|
||||||
|
* Sides of the CROSS SECTION. Four, the default, is the square this always
|
||||||
|
* was and reproduces it corner for corner.
|
||||||
|
*
|
||||||
|
* More than four rounds it, and `thickness` goes on meaning the same thing:
|
||||||
|
* the width across the section. A square handle strap has four hard edges
|
||||||
|
* running the length of the loop and they catch the light as ridges, which
|
||||||
|
* is what made a mug handle read as a folded ribbon however well its
|
||||||
|
* proportions were set. A real one is an oval, and an oval is what a
|
||||||
|
* twelve-sided section scaled unevenly gives.
|
||||||
|
*/
|
||||||
|
sides = 4,
|
||||||
): BufferGeometry {
|
): BufferGeometry {
|
||||||
const sink: Sink = { position: [], color: [] }
|
const sink: Sink = { position: [], color: [] }
|
||||||
const h = thickness / 2
|
const h = thickness / 2
|
||||||
|
|
@ -519,21 +531,36 @@ export function arcBarGeometry(
|
||||||
const at = (su: number, sv: number): Vec3 =>
|
const at = (su: number, sv: number): Vec3 =>
|
||||||
[px + sv * h * rx, py + sv * h * ry, cz + su * h]
|
[px + sv * h * rx, py + sv * h * ry, cz + su * h]
|
||||||
// u = the plane normal, v = the radial direction. Since u×v equals the
|
// u = the plane normal, v = the radial direction. Since u×v equals the
|
||||||
// tangent, this ordering is counter-clockwise relative to the sweep direction.
|
// tangent, this ordering is counter-clockwise relative to the sweep
|
||||||
rings.push([at(1, 1), at(-1, 1), at(-1, -1), at(1, -1)])
|
// direction, and the half-step offset is what puts a four-sided section's
|
||||||
|
// corners exactly where the hand-written [1,1] [-1,1] [-1,-1] [1,-1] put
|
||||||
|
// them. `reach` keeps `thickness` meaning the width across: the corner
|
||||||
|
// circle circumscribes the square at four sides and IS the section at
|
||||||
|
// more.
|
||||||
|
const reach = sides === 4 ? Math.SQRT2 : 1
|
||||||
|
const ring: Vec3[] = []
|
||||||
|
for (let j = 0; j < sides; j += 1) {
|
||||||
|
const t = ((j + 0.5) / sides) * Math.PI * 2
|
||||||
|
ring.push(at(Math.cos(t) * reach, Math.sin(t) * reach))
|
||||||
|
}
|
||||||
|
rings.push(ring)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < segments; i += 1) {
|
for (let i = 0; i < segments; i += 1) {
|
||||||
const a = rings[i]!, b = rings[i + 1]!
|
const a = rings[i]!, b = rings[i + 1]!
|
||||||
for (let j = 0; j < 4; j += 1) {
|
for (let j = 0; j < sides; j += 1) {
|
||||||
const k = (j + 1) % 4
|
const k = (j + 1) % sides
|
||||||
quad(sink, a[j]!, a[k]!, b[k]!, b[j]!, colour)
|
quad(sink, a[j]!, a[k]!, b[k]!, b[j]!, colour)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fans rather than quads, because the section is no longer always four
|
||||||
|
// sided. At four they are the same two triangles the quad was.
|
||||||
const first = rings[0]!, last = rings[segments]!
|
const first = rings[0]!, last = rings[segments]!
|
||||||
quad(sink, first[0]!, first[3]!, first[2]!, first[1]!, colour) // start cap
|
for (let j = 1; j < sides - 1; j += 1) {
|
||||||
quad(sink, last[0]!, last[1]!, last[2]!, last[3]!, colour) // end cap
|
tri(sink, first[0]!, first[j + 1]!, first[j]!, colour)
|
||||||
|
tri(sink, last[0]!, last[j]!, last[j + 1]!, colour)
|
||||||
|
}
|
||||||
return finish(sink)
|
return finish(sink)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue