문제

x, y, z = pos
radius = width / 2.0
if width >= 0.0:
    x = -x
a = radius * math.pi
a = (x/a) * math.pi

This is a code snippet from someone other than me, and I've been wanting to understand it. However, the variable a is a little ambiguous, and I'm having trouble figuring out its purpose.

This snippet is part of a function that calculates an arch that text will be displayed over.

The variable pos is the position of the current letter we are working with. The variable width is the width of the entire line.

도움이 되었습니까?

해결책

There is nonsense usage of math.pi - result doesn't depend on it.
a = x/R = Cos(Fi), where Fi is direction angle of (coordinate origin - starting point) vector, if R is radius of arc with origin as center

(Cos(Fi) negated for positive width values)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top