-
-
Save miguelsousa/f2d7c102cf9758c74e97a75e5f4341a6 to your computer and use it in GitHub Desktop.
Axis variation mapping generator for the slant axis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| from __future__ import division, print_function | |
| from math import atan, pi, tan | |
| start_angle = -15 | |
| end_angle = 15 | |
| step = 0.1 | |
| tolerance = 0.08 | |
| mappings = [(start_angle, start_angle), (0.0, 0.0), (end_angle, end_angle)] | |
| actual_angle = start_angle | |
| while actual_angle < 0: | |
| mapping = start_angle * tan(pi * actual_angle / 180) / tan(pi * start_angle / 180) | |
| if abs(actual_angle - mapping) > tolerance: | |
| mappings.append((actual_angle, mapping)) | |
| actual_angle += step | |
| actual_angle = 0 | |
| while actual_angle < end_angle: | |
| mapping = end_angle * tan(pi * actual_angle / 180) / tan(pi * end_angle / 180) | |
| if abs(actual_angle - mapping) > tolerance: | |
| mappings.append((actual_angle, mapping)) | |
| actual_angle += step | |
| for mapping in sorted(set(mappings)): | |
| print(' <map input="%0.6f" output="%0.6f" />' % mapping) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment