TLDR: What’s easier for a computer: making a curve out of a polygon with a bunch of regular vertices, or making it out of a shape with a couple of quadratic vertices?
So, as the title suggests, I need to generate a hyperbola (the 1/x graph). Specifically a hyperbola of arbitrary width and height (and rotation, and position).
There are two approaches I’ve taken to this: one is to draw an open polygon with a bunch of vertices (about 64), and the other is to draw a shape made of a few quadratic vertices (about 8). At first I just wanted to ask which approach would yield a more accurate approximation per unit time spent computing & rendering it all, but now that I think about it, I suppose I also have to ask if there are any more efficient approaches to this (there probably are).
For reference, I’ve optimized both approaches so that the computer runs a couple cosh and sinh functions to compute the first few vertices, and uses angle addition formulas to find the rest (so that most of the calculations are simple arithmetic). I also made an optimization so the computer will only look at the vertices that can be seen on screen, so more vertices can be displayed at once.
If someone could tell me which technique is faster, and if there are any approaches that would be even faster, that’d be great. Thank you!
EDIT: I forgot to mention before, but the shape in question needs to have a constant strokeWeight, and won’t be filled in.