Code for Concentric Map
Concentric mapping is a commonly used method for mapping points on a unit square to a unit disc. These are some code samples.
Mappings between Sphere, Disc, and Square
A variety of mappings between a sphere and a disc and between a disc and a square, as well as combinations of both, are used in computer graphics applications, resulting in mappings between spheres and squares. Many options exist for each type of mapping; to pick the right methods for a given application requires knowledge about the nature and magnitude of mapping distortions.
This paper provides an overview of forward and inverse mappings between a unit sphere, a unit disc, and a unit square. Quality measurements relevant for computer graphics applications are derived from tools used in the field of map projection, and a comparative analysis of the mapping methods is given.
A Low-Distortion Map Between Triangle and Square
Abstract: We introduce a low-distortion map between triangle and square. This mapping yields an area-preserving parameterization that can be used for sampling random points with a uniform density in arbitrary triangles. This parameterization presents two advantages compared to the square-root parameterization typically used for triangle sampling. First, it has lower distortions and better preserves the blue noise properties of the input samples. Second, its computation relies only on arithmetic operations(+, *), which makes it faster to evaluate.
Sampling with Hammersley and Halton Points
Abstract: The Hammersley and Halton point sets, two well known low discrepancy sequences, have been used for quasi-Monte Carlo integration in previous research. A deterministic formula generates a uniformly distributed and stochastic-looking sampling pattern, at low computational cost. The Halton point set is also useful for incremental sampling. In this paper, we discuss detailed implementation issues and our experience of choosing suitable bases of the point sets, not just on the 2D plane,but also on a spherical surface. The sampling scheme is also applied to ray tracing, with a significant improvement in error.
Point in Polygon Detection Strategies
Testing whether a point is inside a polygon is a basic operation in computer graphics. Graphics Gems presents an algorithm for testing points against convex polygons (Badouel 1990). This Gem provides algorithms which are from 1.6 to 9 or more times faster for convex polygons. It also presents algorithms for testing non-convex polygons and discusses the advantages and drawbacks of each. Faster, more memory intensive algorithms are also presented, along with an O(log n) algorithm for convex polygons. Code is included for the algorithms discussed.
C FAQ
Content from the book "C Programming FAQs: Frequently Asked Questions"