Stereographic Projection

Introduction

Stereographic projection is a method for mapping points on a sphere onto a plane. It's a conformal projection, meaning it preserves angles, and is often used in map making and structural geology. It's particularly useful for visualizing data on a sphere in two dimensions, such as geological structures or orientation.

Project #1

Create a program that does stereographic projection of points on a sphere onto a plane. (See video "This is Not About Spacetime")

Let the user define the points? Draw lines? Project a circle on the sphere onto the plane?

For this project, use graphics.py. It is a simple graphics library. Click HERE for more information. (download, install, documentation, ...)

Links

Stereographic projection (Wikipedia)

Projective geometry (Wikipedia)

This is Not About Spacetime (YouTube)

FYI

The intersection of a line and a plane in 3D space can result in three possibilities:

FYI - numpy

#!/usr/bin/python3 # ======================================================================= # intersection of line and plane (code found on the web) # ======================================================================= import numpy as np def intersect_line_plane(line_point, line_direction, plane_point, plane_normal): line_point = np.array(line_point) line_direction = np.array(line_direction) plane_point = np.array(plane_point) plane_normal = np.array(plane_normal) dot_product_direction_normal = np.dot(line_direction, plane_normal) if dot_product_direction_normal == 0: # Line is parallel to the plane if np.dot(line_point - plane_point, plane_normal) == 0: return "Line lies in the plane (infinite intersections)" else: return "Line is parallel to the plane and does not intersect" else: # Unique intersection point t = -np.dot(line_point - plane_point, plane_normal)/ \ dot_product_direction_normal intersection_point = line_point + (t * line_direction) return intersection_point # ----------------------------------------------------------------------- # main # ----------------------------------------------------------------------- # Example line_pt = [2, 0, 2] line_dir = [0, 1, 0] plane_pt = [0, 0, 0] plane_norm = [0, 1, 0] intersection = intersect_line_plane(line_pt,line_dir,plane_pt,plane_norm) print() print(f'intersection is {type(intersection)}') print(f'x = {intersection[0]:.3f}') print(f'y = {intersection[1]:.3f}') print(f'z = {intersection[2]:.3f}') print()

FYI - skspatial

The skspatial module, also known as scikit-spatial, is a Python library designed for working with spatial objects and performing geometric computations in 2D, 3D, and higher-dimensional spaces. It builds upon NumPy arrays, allowing for efficient numerical operations.

It defines various spatial objects as classes, including:
Point, Points
Vector
Line, LineSegment
Plane
Circle, Sphere
Triangle
Cylinder

pip install scikit-spatial

If you also wish to enable the plotting functionalities within scikit-spatial, which rely on matplotlib, you can install it with the [plotting]

pip install 'scikit-spatial[plotting]'

https://pypi.org/project/scikit-spatial/ (home)

scikit-spatial (documentation)

FYI - Calculate a Normal Vector

For more information click HERE .

The Point Where a Line Intersects a Plane

3D Line-Plane Intersection

Hints

Hint #1

Hint #2

Hint #3