SVG Graphics Geometry
Guide
css-matrix
Guide
css-matrix
  • Part 0. SVG 기초

    • SVG란 무엇인가
    • viewBox와 user space
    • transform attribute와 matrix
    • SVG 문서 구조와 기본 도형
  • Part 1. Path grammar

    • path d 명령어 — M, L, Z
    • H, V — 축 정렬 직선
    • C — cubic Bézier
    • Q — quadratic Bézier
    • S, T — smooth continuation
    • A — elliptical arc
    • path bounding box
  • Part 2. Stroke geometry

    • 점에서 stroke까지의 거리
    • join, cap, miter limit
    • stroke align과 outline 개념
    • miter length 공식
  • Part 3. Fill rules

    • nonzero vs evenodd
    • fill hit testing
  • Part 4. Path sampling

    • flatten tolerance
    • path length
    • point at length와 tangent
  • Part 5. Paint servers

    • linearGradient 좌표
    • clipPath와 mask 개념
  • Part 6. Path editor capstone

    • path handle 모델
    • handle hit testing
    • handle drag로 segment 갱신
    • mini path editor — SVG round-trip
  • Part 7. Fill & winding deep dive

    • winding vs ray casting
    • compound path — 여러 subpath
    • self-intersection
    • path boolean
    • fill vs stroke hit 우선순위
    • scanline parity
  • Part 8. Pattern & gradient

    • radialGradient
    • pattern tile
    • gradientUnits와 spreadMethod
  • Part 9. SVG filter & Figma effects

    • Figma DROP_SHADOW → SVG filter
    • filter chain 개요
    • blur · offset · merge
    • inner shadow
    • layer blur vs background blur
    • Figma effect 매핑표 전체
  • Part 10. Figma ↔ SVG bridge

    • vector network vs path d
    • fill · stroke export
    • boolean operations export
    • mask · clip export
  • Part 11. Icon design

    • pixel grid · optical alignment
    • fill vs stroke icons
    • symbol · sprite · currentColor
    • path simplification
  • Appendix A. SVG in CSS

    • currentColor · CSS theming
    • sprite data URI
    • SVG optimization pipeline
  • Appendix B. Engine extras

    • dash offset animation
    • adaptive flatten
    • arc → cubic 변환
    • multi-subpath editing
  • Part 12. Foundations primer

    • capability map
    • coordinate stack
  • Part 13. Figma ↔ SVG (deep)

    • Figma paint gap map
    • radial · angular gradient export
    • image · pattern fill
    • stroke align export
    • blend mode · layer opacity
  • Part 14. SVG spec breadth

    • markers — 화살표와 dash 끝
    • text · textPath
    • paint-order · opacity · filters
    • arc flatten 통합
  • Part 15. Curve calculus

    • de Casteljau subdivision
    • flatness와 chord error
    • 곡률 κ와 법선
    • arc center parameterization
    • G¹ smooth — S와 T
    • shoelace signed area
  • Part 16. Intersection & proximity

    • segment intersection
    • line ∩ cubic · curve ∩ curve
    • closest point on curve
  • Part 17. Offset curves

    • normal offset sampling
    • offset cusps
  • Part 18. Transform algebra

    • affine inverse & decompose
    • transform path vs group
  • Part 19. Rational curves

    • circle as cubic — κ constant
    • rational curves & exact arcs
  • Part 20. Tessellation & pixels

    • convex triangulation · ear clipping
    • evenodd parity → pixels
  • Part 21. Compositing math

    • Gaussian blur kernel
    • Porter–Duff & premultiplied α
  • Part 22. Math topic map

    • SVG 수학 주제 지도
  • Part 23. SVG animation

    • SMIL — animate 속성
    • SMIL — animateTransform
    • SMIL — animateMotion
    • stroke dash draw-on
    • CSS offset-path motion
    • path morph
    • JS motion along path
  • Part 24. Motion precision

    • uniform speed along path
    • cubic–cubic intersection
    • SVGPathElement length API
    • SMIL keyTimes & keySplines
    • degree elevation Q→C
  • Part 25. GPU mesh & WAAPI

    • triangulation with holes
    • WAAPI + SVG attributes
    • evenodd fill + triangle mesh

join, cap, miter limit

stroke는 path 중심선을 따라 그리지만, 모서리(join) 와 열린 끝(cap) 에서는 중심선만으로 모양이 정해지지 않습니다. SVG는 stroke-linejoin, stroke-linecap, stroke-miterlimit로 규칙을 고정합니다. 004 stroke hit은 중심선 거리이고, 여기서는 렌더 규칙입니다.

데모에서 볼 것

M 80 300 L 220 120 L 360 300

열린 polyline — stroke-width: 18.

controlSVG 속성
joinstroke-linejoin: miter / round / bevel
capstroke-linecap: butt / round / square
miterlimitstroke-miterlimit (1–20, 기본 4)
  • miter + 낮은 limit + acute 꼭짓점 (220, 120) → 긴 spike 또는 bevel fallback
  • round join/cap → 반지름 strokeWidth/2 원호
  • butt cap → 끝점에서 수직으로 자름 (열린 path 양 끝)

readout에 join/cap/limit 값이 표시됩니다. 수치 계산은 013 miter-math 데모.

linejoin — 두 segment가 만나는 점

값기하
miter바깥 edge를 연장한 교점 = 꼭짓점
bevelspike 잘라 직선 연결
round원호 (반지름 ≈ sw/2)

acute angle일수록 miter 교점이 중심선에서 멀어집니다. stroke-miterlimit × strokeWidth를 넘으면 브라우저·SVG는 bevel로 그립니다.

import { miterLength, shouldBevelJoin, segmentTurnAngle } from "svg-matrix-core";

const incoming = { x: 1, y: 0 };
const outgoing = { x: -0.5, y: 0.866 };
const turn = segmentTurnAngle(incoming, outgoing);

const strokeWidth = 18;
const miterLimit = 4;
const spike = miterLength(turn, strokeWidth);
const useBevel = shouldBevelJoin(turn, strokeWidth, miterLimit);

공식·내각↔turn 변환 — 013.

linecap — 열린 path의 끝

값모양path 길이·hit
butt끝점에서 자름017 length = centerline
round끝에 반원cap 밖 클릭은 stroke miss (004)
squaretangent 방향으로 sw/2 연장 후 자름시각적으로 path가 길어 보임

닫힌 path(Z)에서는 cap이 거의 보이지 않고 join이 지배합니다.

SVG · Canvas · Figma

<path d="..." fill="none" stroke="currentColor"
  stroke-width="18"
  stroke-linejoin="round"
  stroke-linecap="round"
  stroke-miterlimit="4" />
ctx.lineJoin = "round";
ctx.lineCap = "round";
ctx.miterLimit = 4;

Figma stroke.join / stroke.miterLimit → SVG export (figma-bridge: MITER / BEVEL / ROUND).

편집기 · hit

레이어내용
geometrycenterline segments (003)
stroke renderjoin/cap 규칙 (브라우저 또는 자체 mesh)
hit004 distance ≤ sw/2 — join spike는 별도 (miter가 bbox 밖으로 나갈 수 있음)

굵은 stroke UI는 helper band를 넓혀 잡기 쉽게 하는 경우가 많습니다.

연결

강의주제
013miter length 수식
006inside/outside stroke (SVG는 center만)
051dash phase (css-matrix)
078offset cusp (다른 “좁은 각”)

Core API

함수역할
segmentTurnAngleincoming/outgoing → turn
miterLengthturn + sw → spike 길이
shouldBevelJoinlimit 초과 여부

관련

  • 004 · 013 · 006

오늘의 핵심

join/cap은 같은 centerline에 다른 stroke renderer입니다. preview·export·Figma bridge가 동일 속성·013 miter 규칙을 쓰면 브라우저와 맞습니다.

최근 수정: 26. 5. 17. PM 4:35
Contributors: jinho.park.s3, Cursor
Prev
점에서 stroke까지의 거리
Next
stroke align과 outline 개념