|
From: | Daniel J Sebald |
Subject: | Re: plotted circle is regular decagon on opengl graphics |
Date: | Fri, 12 Aug 2016 00:13:57 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 |
On 08/11/2016 03:28 PM, Robert Funnell wrote:
On Thu, 11 Aug 2016, Rik wrote:
The performance cost is the cos/sin computations, not the underlying driver. The driver essentially sweeps out the same arc no matter how fine the angular resolution is (i.e., it may draw more polygon lines, but the individual polygon lines are shorter so don't need as many computations to complete).I'm happy to have something different in place. The procedure here (http://slabode.exofire.net/circle_draw.shtml) uses only multiplications and additions and is possibly faster than either the trig approach or the sqrt approach. Probably easy to benchmark all three options since the only thing that needs testing is the creation of the vertex points, not the actual calls to OpenGL.
These are nice Rik. It's sort of a differential approach. I actually like the vector rotation at first blush, and since you already have the increment-angle calculation code you'd just need to compute the angular rotation matrix at the start. The tangent-subtraction algorithm probably works fine with floating point precision, the risk being that any inaccuracy of the computation could accumulate and the start and end points don't quite meet up correctly.
--RikFWIW, your mention of using only multiplications and additions reminded me of the algorithm that I've been using since 1985, from Van Aken (1984) (http://dx.doi.org/10.1109/MCG.1984.275994). It uses only additions. - Robert
Looks like a classic paper Robert. These types of algorithms are what I meant by graphics hardware optimization, trying to find the utmost minimum calculations with simple computations (thereby not requiring a general purpose CPU, floating point co-processor unit, etc.) and still retain accuracy given pixel resolution.
Dan
[Prev in Thread] | Current Thread | [Next in Thread] |