Description
The current symbol for inductors features bumps on the side (at least for the IEEE variant). However, inductors can also be drawn with a series of loops instead, so that it looks more like a coil. I noticed this feature was missing from the component library so I thought I'd request it here.
The math for drawing this component would probably be hard to figure out manually, but CeTZ comes to the rescue and has a handy cetz.decorations.coil function that can do most of the heavy lifting. So it shouldn't be too difficult to implement.
We could probably modify the existing inductor component to accept a coiled parameter and draws the bumpy or loopy version of the inductor depending on whether it's set or not. CeTZ's coil utility also accepts some extra parameters like coil ratio or amplitude, so we could add them to the inductor's style parameters as well.
Here is my best attempt at making it:
#let draw(ctx, position, style) = {
interface((-style.width / 2, -style.height / 2), (style.width / 2, style.height / 2), io: position.len() < 2)
set-style(stroke: style.stroke)
coil(
line((-style.width / 2, 0), (style.width / 2, 0)),
amplitude: style.height,
segments: style.bumps,
factor: style.coil-ratio
)
if variable {
adjust-arrow("variable")
} else if preset {
adjust-arrow("preset")
} else if sensor {
adjust-arrow("sensor")
}
}
Side note: I also thought of adding a "flipped" parameter to the inductor that controls which side the bumps or loops are drawn on. There are also some other variants that have lines going through the center to indicate what core the inductor is made of, but that's probably best for another issue.
References or images
Here is the reference I loosely tried to base my component off:
Contribute
Description
The current symbol for inductors features bumps on the side (at least for the IEEE variant). However, inductors can also be drawn with a series of loops instead, so that it looks more like a coil. I noticed this feature was missing from the component library so I thought I'd request it here.
The math for drawing this component would probably be hard to figure out manually, but CeTZ comes to the rescue and has a handy
cetz.decorations.coilfunction that can do most of the heavy lifting. So it shouldn't be too difficult to implement.We could probably modify the existing inductor component to accept a
coiledparameter and draws the bumpy or loopy version of the inductor depending on whether it's set or not. CeTZ'scoilutility also accepts some extra parameters like coil ratio or amplitude, so we could add them to the inductor's style parameters as well.Here is my best attempt at making it:
Side note: I also thought of adding a "flipped" parameter to the inductor that controls which side the bumps or loops are drawn on. There are also some other variants that have lines going through the center to indicate what core the inductor is made of, but that's probably best for another issue.
References or images
Here is the reference I loosely tried to base my component off:
Contribute