Testing for Anti-Aliasing?


#1

Is this possible on Windows and OSX? I’ve been looking through the API docs and haven’t seen anything, so I figured I’d check here to make sure.


#2

Aliasing is a signal processing issue and not windows /OSX. Do a search on Nyquist sampling if you want to learn more. It basically states 2Fs> Fm where Fs is sampling rate and Fm is max frequency of signal being sampled. There are techniques to reduced at the expense of lower rates. The main issue for SU is the saw tooth appearance of lines when you zoom way in.
I think of it as the impulse response of the display pixels as it is scanned.


#3

on a mac SU has Test.get_AA_method
which will return 0,1,2,3 or 4 dependent on the setting…
it has a twin in Test.set_AA_method=
I don’t believe there is the same on windose…
you could possibly read the preferences dependant on what you need…
john


#4

The methods in the Test module are not a public API but for internal use by SketchUp. It appears there are more (interesting) methods that appear and disappear from time to time. The Windows SketchUp version 2015 currently doesn’t respond to get_AA_method.

What is your plan, so that the anti-aliasing setting could be relevant to you? It’s a client implementation detail, and should be fully under the control of the client/user (like text rendering, text hinting preferences or dpi).
As an example, with high enough screen resolution, the higher dpi leads to an equivalent result as anti-aliasing. If you wanted to code specifically for each of these branches of possibilities, that introduces more special cases into your code. Be happy as long as you can keep your code abstract and general.


#5

So, the main reason why I’m testing for anti-aliasing is due to an issue with a feature for a plugin I’m working on; I have no intention of changing it - I’m just looking for an explicit means of detecting whether or not it’s enabled.

Something like:

if SketchUp.active_model.get_aa_sample_count > 0
      // Warn user about AA in combination with feature
end

However, it seems like there is no method for this, so a workaround has been made in the mean time.


#6

I’ve discovered a couple of anti alias tactics.
1. Golden Ratio
2. 22.5 degrees

A golden rectangle is defined as one which, if a square of the shorter edge is cut off, the drop (no kerf) is proportioned the same as the original piece. Here’s how to generate a golden rectangle fractally.

Draw a square. Draw a second square with one common edge.
Draw a 2square with one edge in common with 2 edges of the 1st 2 squares.
Draw a 3square with one edge in common with an edge of the 2 and one edge of the 1s.
Draw a 5square with one edge in common with an edge of the 3 and an edge of the 2.
etc.

The fundament of this fractal golden rectangle is the Fibonacci series.
F(N)= F(N-1) + F(N-2)

Now let me find the way to post images.