I'm trying to utilize SVG's to dynamically draw lines onto a cylindrical looking surface. Because it's cylindrical, any straight line between two points will actually follow an elliptical slice of the cylinder, and therefore need to be rendered as a section of an elliptical arc.
As the docs state, SVG arcs are defined as: "A rx ry x-axis-rotation large-arc-flag sweep-flag x y"
Please tell me where I'm going wrong in deriving this arc (AB).
- So obviously I know my starting and ending points (AB).
- I am assuming that ry in both the cylinder and slice are equal.
- rx is half the slice's hypotenuse.
θ is the x-axis rotation... I think?
This is where I think I'm getting into trouble. As you can see in the second image when I try converting all my line paths into arcs, some of the ars turn out perfect when they are not rotated (they are parallel to the x-axis in the rectangular plane, meaning they follow the arc path of the primary cylindrical ellipse), however, something funny is happening with the rotation. When I turn on the large-arc-flag it's pretty evident that the ellipses being drawn are not at all lining up with my cylinder.
I'm fairly confident that the hypotenuse is being calculated correctly, as setting θ to zero gives me the cylinder's diameter, so I'm a bit flummoxed as to where I'm going wrong.
TLDR: Given the data I provided in image 1, how would you go about drawing the arc AB.
EDIT 1: Here is an SVG of a cylinder and a line to play around with. Again, I'm trying to make the line into an arc to fit on the cylinder surface so it matches the ellipse arc formed by a slice through the cylinder.
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path id="cylinder" fill="none" stroke="#000000" stroke-width="2" d="M 0 32 a148 32 0 0 0 296 0 a148 32 0 0 0 -296 0 v185 a148 32 0 0 0 296 0 v-185"/>
<path id="line_should_become_arc" fill="none" stroke="#000000" stroke-width="2" d="M 37 106 L 259 148"/>
</svg>