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

A — elliptical arc

A 명령은 타원 호 하나를 정의합니다. 008 C와 달리 제어점이 아니라 반경·회전·flag·끝점으로 호를 고릅니다. SVG 스펙상 타원 호는 정확하고, cubic-only 엔진은 보통 내부에서 C chain으로 바꿉니다.

문법

A rx ry x-axis-rotation large-arc-flag sweep-flag x y

상대 좌표면 a — to만 현재점 기준 offset.

import { parsePathD } from "svg-matrix-core";

const segments = parsePathD("M 80 300 A 120 80 0 0 1 560 120");
const arc = segments.find((s) => s.type === "A");
// {
//   type: "A",
//   from, to,
//   rx: 120, ry: 80,
//   rotation: 0,
//   largeArc: false,
//   sweep: true
// }

데모 path가 위와 동일합니다. mountPathCommandDemo — segment 리스트 + pathDFromSegments rebuild readout (003 grammar 데모와 동일 패턴).

파라미터 직관

필드의미
rx, ry타원 반경 (음수면 절댓값; chord가 너무 길면 스펙상 확대 — svgArcCenterParameters의 λ 보정)
rotation타원 축 회전 (도)
largeArc같은 끝점 사이 큰 호 vs 작은 호 (180° 기준)
sweep진행 방향 — SVG 좌표계에서 시계 vs 반시계
        P0 (from)                    P1 (to)
           ●────────────────────────────●
              ╲    호 A (2개 후보)    ╱
               ╲  large/sweep 고름 ╱
                ●───────────────●
                   타원 위

flag를 바꾸면 같은 rx,ry로도 다른 호가 선택됩니다. 편집기에서 arc handle을 드래그할 때 이 네 조합 중 하나가 고정됩니다.

endpoint vs center (071)

path d는 끝점 파라미터만 저장합니다. 디버그·호 편집에는 중심형이 편합니다.

import { svgArcCenterParameters } from "svg-matrix-core";

const params = svgArcCenterParameters(arc);
// { cx, cy, rx, ry, phi, startAngle, deltaAngle, degenerate }

071 geom-arc-center 데모 — 빨간 점이 (cx, cy).

arc → cubic

import { arcSegmentToCubics } from "svg-matrix-core";

const cubics = arcSegmentToCubics(arc);
// |Δθ| > 90° 이면 90° slice마다 C 하나 ([arc.js](../../svg-matrix-core/src/arc.js))
import { convertArcsInPathD } from "svg-matrix-core";

const { d, segments, arcCount } = convertArcsInPathD(
  "M 0 50 A 50 50 0 0 1 100 50"
);
// d에 A 없음, C만 — arcCount === 1
목적API
path d에서 A 제거convertArcsInPathD
segment graph 유지convertArcsToCubics (engine.js)
단일 arc 분해arcSegmentToCubics

053 · 082 export 파이프라인.

flatten · bbox

A는 flattenPathSegments에서 먼저 cubic으로 쪼갠 뒤 샘플합니다 — chord P0→P1 직선 보간이 아닙니다.

import { flattenPathSegments } from "svg-matrix-core";

const poly = flattenPathSegments(segments, {
  stepsPerCurve: 20,
  stepsPerArc: 24   // arc당 cubic slice마다 step
});

012 bboxOfPath의 A도 sampleArc → min/max (근사 bbox).
chord lerp vs arc→cubic 비교 overlay는 065 arc-flatten-unified 데모.

016 uniform · 052 adaptive — A는 arcSegmentToCubics 후 cubic에 동일 적용.

vs 원 primitive

표현정확도path d
<circle>정확요소 별도
A정확 타원 호✓
4× κ cubic근사 원081

아이콘 원을 path만 쓸 때: A 유지 vs κ×4 vs import 시 convertArcsInPathD.

편집기 전략

import:  A 유지 (호 편집)  |  convertArcsInPathD (cubic-only 코어)
edit:    endpoint / center handles ([071](./lesson-071.md))
export:  A 복원 (가능하면)  |  C만 (일부 뷰어 동일)

024 path editor — segment type A가 graph에 남는지는 제품 정책.

Core API

함수역할
parsePathDA segment 파싱
svgArcCenterParametersendpoint → (cx, cy, θ)
arcSegmentToCubics호 → C[]
convertArcsInPathDd 문자열에서 A 제거
flattenPathSegmentssampleArc + stepsPerArc

관련

  • 071 center · 053 변환 · 065 flatten 비교 · 081 · 082

오늘의 핵심

A는 스펙상 정확한 타원 호입니다. cubic-only 코어라면 import 시 arcSegmentToCubics로 한 번 변환하고, flatten·length·hit은 그 C chain에 016·052를 적용하세요. chord 직선 보간은 065에서 “안 되는 예”로만 비교합니다.

최근 수정: 26. 5. 17. PM 4:35
Contributors: jinho.park.s3, Cursor
Prev
S, T — smooth continuation
Next
path bounding box