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 a shape (point, line, rectangle, circle, ...) on a sphere onto a plane.

See video "This is Not About Spacetime".

Note: Start with a point on a sphere. Move it to various location on the sphere to test your code.

Project #2

Create a program that projects a shape on a plane onto a sphere. (point, line, rectangle, circle, ...)

Note: Start with a point on a plane. Move it to various location on the plane to test your code.

Graphics Library

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_point = [2, 0, 2] line_direction = [0, 1, 0] plane_point = [0, 0, 0] plane_normal = [0, 1, 0] intersection = intersect_line_plane(line_point,line_direction, plane_point,plane_normal) 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

Cheat Sheet

Definitions

Cartesian
coordinates
A system for locating a point in space using a set of perpendicular axes, such as the X axis and Y axis in a 2D plane or X Y Z axes for 3D space.
The position is defined by a set of numbers (x, y, z) that represent the distance of the point from each axis, starting from a central point
called the origin.
graphics object A visual element used to display data, such as a line, circle, or text. The object as attributes that can be customized;
For example shape, width, coordinates, color, etc.
line A one-dimensional geometric object defined as a straight path that extends infinitely in both directions, has no thickness or curves,
and is made up of an endless number of points.
line segment A part of a line that has two distinct endpoints, meaning it has a fixed length and a definite beginning and end.
plane A flat, two-dimensional surface that extends infinitely in all directions and has no thickness.
point A location in space that has no dimensions (no length, width, or thickness) and is often represented by a dot.
sphere A round solid figure, or its surface, with every point on its surface equidistant from its center.
vector A vector is a quantity that has both magnitude and direction.

The "origin" of a vector refers to its starting point in a coordinate system. Typically it is the point where the axes intersect (0,0).
This origin serves as a reference point from which the vector's magnitude and direction are determined.