Battle of Locust Grove

Page contents not supported in other languages.

Original file(SVG file, nominally 1,500 × 1,000 pixels, file size: 2 KB)

Summary

Description
English: Nested Ellipses , Parameters: a=5, b=4 theta=0.2617993877991494 r=0.9434598957108945 number of ellipses=61.
"The spiral itself is not drawn: we see it as the locus of points where the circles are especially close to each other." [1]
Date
Source Own work
Author Adam majewski
Other versions
SVG development
InfoField
 
The SVG code is valid.
 
This diagram was created with a text editor.
Previous version had been created with Gnuplot (15 566 434 bytes)  d  now 0.01% of previous size
 
Please do not replace the simplified code of this file with a version created with Inkscape or any other vector graphics editor

Algorithm

Ellipse centered at origin and not rotated

NOtation

the equation of a ellipse:

  • centered at the origin
  • with width = 2a and height = 2b

the parametric equation is:

So explicit equations :

The parameter t :

  • is called the eccentric anomaly in astronomy
  • is not the angle of with the x-axis
  • can be called internal angle of the ellipse

ellipse rotated and not moved

Rotation In two dimensions

A counterclockwise rotation of a vector through angle Template:Mvar. The vector is initially aligned with the Template:Mvar-axis.

In two dimensions, the standard rotation matrix has the following form:

.

This rotates column vectors by means of the following matrix multiplication,

.

Thus, the new coordinates (x′, y′) of a point (x, y) after rotation are

.

result

Center is in the origin ( not shifted or not moved) and rotated:

  • center is the origin z = (0, 0)
  • is the angle measured from x axis
  • The parameter t (called the eccentric anomaly in astronomy) is not the angle of with the x-axis
  • a,b are the semi-axis in the x and y directions




Here

  • is fixed ( constant value)
  • t is a parameter = independent variable used to parametrise the ellipse


So

intersection of 2 ellipses

Intersection = common points

not scaled

2 ellipses:

  • both are cetered at origin
  • first is not rotated, second is rotated (constant angle theta)
  • with the same the aspect ratio s (the ratio of the major axis to the minor axis)




Fix x, then find y:

scaled

Second is scaled by factor r[5]



where:

  • is the tilt angle


Python source code

import math, io
def make_svg(x_offset, y_offset):
 outs  = []
 n     = 61
 a     = 6035
 b     = 4828
 theta = 15
 delta = (1.0 * a / b - 1.0 * b / a) * math.sin(math.radians(theta))
 r     = (1 + delta * delta / 4) ** 0.5 - delta / 2
 # print(delta, r)
 for i in range(n):
  a_i = a * r ** i
  b_i = b * r ** i
  deg = (-theta * i) % 180
  rad = math.radians(deg)
  t   = math.pi * 1.5 if deg == 0 else math.pi + math.atan(b_i * math.cos(rad) / (a_i * math.sin(rad)))
  x   = a_i * math.cos(rad) * math.cos(t) - b_i * math.sin(rad) * math.sin(t) + x_offset - 65
  y   = a_i * math.sin(rad) * math.cos(t) + b_i * math.cos(rad) * math.sin(t) + y_offset + 8
  ## formulae from http://math.stackexchange.com/questions/1889450/extrema-of-ellipse-from-parametric-form
  # print(i, deg, t)
  outs.append('M%.0f%s%.0fa%.0f,%.0f %.0f 1 0 1,0' % (x, '' if y < 0 else ',', y, a_i, b_i, deg))
 return '''<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1500" height="1000" viewBox="%d %d 15000 10000">
<path d="%s" fill="none" stroke="#f00" stroke-width="9"/>
</svg>''' % (x_offset - 7500, y_offset - 5000, ''.join(outs))
# <path d="%s" fill="none" stroke="#f00" stroke-width="9" marker-mid="url(#m)"/>
# <marker id="m"><circle r="9"/></marker>

## Find shortest output and write to file
(x_offset_min, length_min) = (0, 99999)
for x_offset in range(-9999, 9999, 1):
 length = len(make_svg(x_offset, 0))
 if length_min > length: (x_offset_min, length_min) = (x_offset, length)
 # print(x_offset, length)
print(x_offset_min, length_min)
(y_offset_min, length_min) = (0, 99999)
for y_offset in range(-9999, 9999, 1):
 length = len(make_svg(0, y_offset))
 if length_min > length: (y_offset_min, length_min) = (y_offset, length)
 # print(y_offset, length)
print(y_offset_min, length_min)
with io.open(__file__[:__file__.rfind('.')] + '.svg', 'w', newline='\n') as f: ## *.* -> *.svg
 f.write(make_svg(x_offset_min, y_offset_min))

Maxima CAS src code

/*

kissing ellipses



These animations are constructed by shrinking and rotating a sequence of concentric and similar ellipses,
so that each ellipse lies inside the previous ellipse and is tangent to it.

https://benice-equation.blogspot.com/2019/01/nested-ellipses.html

==================================================
https://math.stackexchange.com/questions/3773593/given-ellipse-of-axes-a-and-b-find-axes-of-tangential-and-concentric-ellips

tangential concentric ellipse and insribed ellipses

Let’s say I have an ellipse with horizontal axis $a$ and vertical axis $b$, centered at $(0,0)$. 
I want to compute $a’$ and $b’$ of a smaller ellipse centered at $(0,0)$, 
with the axes rotated by some angle $t$, tangent to the bigger ellipse and $\frac{a’}{b’}=\frac{a}{b}$.




---------------------

The standard parametric equation is:

(x,y)->(a cos(t),b sin(t))


---------------------------

Rotation counterclockwise about the origin through an angle α carries 

(x, y) to (x cos α − ysin α, ycos α+x sin α) 

https://www.maa.org/external_archive/joma/Volume8/Kalman/General.html

=====================================
https://math.stackexchange.com/questions/2987044/how-to-find-the-equation-of-a-rotated-ellipse

===============================
https://math.stackexchange.com/questions/3773593/given-ellipse-of-axes-a-and-b-find-axes-of-tangential-and-concentric-ellips

============================================================
intersection of 2 ellipses

the common point of 2 ellipses are not vertices ( vertex)

https://math.stackexchange.com/questions/1688449/intersection-of-two-ellipses
https://math.stackexchange.com/questions/425366/finding-intersection-of-an-ellipse-with-another-ellipse-when-both-are-rotated/425412#425412

https://math.stackexchange.com/questions/3312747/intersection-area-of-concentric-ellipses
https://math.stackexchange.com/questions/426150/what-is-the-general-equation-of-the-ellipse-that-is-not-in-the-origin-and-rotate/434482#434482
------
xc <- 1 # center x_c or h
yc <- 2 # y_c or k
a <- 5 # major axis length
b <- 2 # minor axis length
phi <- pi/3 # angle of major axis with x axis phi or tau

t <- seq(0, 2*pi, 0.01) 
x <- xc + a*cos(t)*cos(phi) - b*sin(t)*sin(phi)
y <- yc + a*cos(t)*cos(phi) + b*sin(t)*cos(phi)
plot(x,y,pch=19, col='blue')
https://stackoverflow.com/questions/41820683/how-to-plot-ellipse-given-a-general-equation-in-r

===============
Batch file for Maxima CAS
save as a e.mac
run maxima : 
 maxima
and then : 
batch("e.mac");




*/


kill(all);
remvalue(all);
ratprint:false;
numer:true$
display2d:false$


/* 
converts complex number z = x*y*%i 
to the list in a draw format:  
[x,y] 
*/
d(z):=[float(realpart(z)), float(imagpart(z))]$

/* give Draw List from one point*/
dl(z):=points([d(z)])$




/* trigonometric functions in Maxima CAS use radians */
deg2rad(t):= float(t*2*%pi/360)$

GiveImplicit(a,b):=implicit( x^2/(a^2) + (y^2)/(b^2) = 1, x, -4,4, y, -4,4)$

GivePointOfEllipse(a,b, t):= a*cos(t) + b*sin(t)*%i$


/*

xc <- 1 # center x_c or h
yc <- 2 # y_c or k
a <- 5 # major axis length
b <- 2 # minor axis length
phi <- pi/3 # angle of major axis with x axis phi or tau

t <- seq(0, 2*pi, 0.01) 
x <- xc + a*cos(t)*cos(phi) - b*sin(t)*sin(phi)
y <- yc + a*cos(t)*sin(phi) + b*sin(t)*cos(phi)

<math>\mathbf{x} =\mathbf{x}_{\theta}(t) = a\cos\ t\cos\theta - b\sin\ t\sin\theta</math>

<math>\mathbf{y} =\mathbf{y}_{\theta}(t) = a\cos\ t\cos\theta + b\sin\ t\cos\theta</math>


https://stackoverflow.com/questions/65278354/how-to-draw-rotated-ellipse-in-maxima-cas/65294520#65294520
*/

GiveRotatedEllipse(a,b,theta, NumberOfPoints):=block(
	[x, y, zz, t , tmin, tmax, dt, c, s],
	zz:[],
	dt : 1/NumberOfPoints, 
 	tmin: 0, 
 	tmax: 2*%pi,
 	c:float(cos(theta)),
 	s:float(sin(theta)),
 	for t:tmin thru tmax step dt do(
 		x: a*cos(t)*c - b*sin(t)*s,
 		x: float(x), 
 		y: a*cos(t)*s + b*sin(t)*c,
 		y:float(y),
 		zz: cons([x,y],zz)
 	),
 	return (points(zz))
)$

GiveScaledRotatedEllipse(a,b, r,theta, NumberOfPoints):= GiveRotatedEllipse(r*a,r*b,theta, NumberOfPoints)$

GiveEllipseN(a,b,r,n,theta, NumberOfPoints):=GiveRotatedEllipse(a*(r^n),b*(r^n),n*theta, NumberOfPoints)$

Give_N(n):= GiveEllipseN(a,b,r,n,theta, NumberOfPoints)$

GiveEllipses(n):=block(
	[elipses],
	
	ellipses:makelist(i, i, 0, n, 1),
	ellipses:map(Give_N, ellipses),
	return(ellipses)
	


)$

/* 
scale ratio r = a'/a = b'/b

https://math.stackexchange.com/questions/3773593/given-ellipse-of-axes-a-and-b-find-axes-of-tangential-and-concentric-ellips
*/
GiveScaleRatio(a, b, theta):= block(
	[d, r], 
	d: (a/b - b/a)*sin(theta), 
	d:float(d),
	r: sqrt(1+d*d/4) - d/2,
	r:float(r),
	return(r)


)$


compile(all)$

/* compute */

/* angles fo trigonometric functions in radians */
angle: 15$
theta:deg2rad(angle) $  /* theta is the angle between    */
a: 5$
b: 4$
NumberOfPoints : 500$
r:GiveScaleRatio(a, b, theta)$  /* 0.942$ the (axis) scaled ratio r = a'/a = b'/b */


n:70;



ee:GiveEllipses(n)$



path:"~/Dokumenty/ellipse/scaled/s1/"$ /*  pwd, if empty then file is in a home dir , path should end with "/" */

/* draw it using draw package by */

 load(draw); 
/* if graphic  file is empty (= 0 bytes) then run draw2d command again */

 draw2d(
  user_preamble="set key top right; unset mouse",
  terminal  = 'svg,
  file_name = sconcat(path, string(a),"_",string(b), "_",string(theta), "_",string(r),"_", string(n)),
   title = "",  
  dimensions = [1500, 1000],
   axis_top         = false,
  axis_right       = false,
  axis_bottom         = false,
  axis_left       = false,
 ytics  = 'none,
 xtics  = 'none,
  proportional_axes = xy,
  line_width = 1,
  line_type = solid,
  
  fill_color = white,
  point_type=filled_circle,
  points_joined = true,
  point_size = 0.05,
  
    
  key = "",
  color = red,
  ee 
  )$
  

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Postprocessing

File size was reduced -29% with https://svgoptimizer.com/

references

  1. Osculating curves: around the Tait-Kneser Theoremby E. Ghys, S. Tabachnikov, V. Timorin
  2. Nested Ellipses (Ellipse Whirl) by benice (C. J. Chen)
  3. math.stackexchange question: given-ellipse-of-axes-a-and-b-find-axes-of-tangential-and-concentric-ellips
  4. texample : rotated-polygons
  5. math.stackexchange question : given-ellipse-of-axes-a-and-b-find-axes-of-tangential-and-concentric-ellips

Captions

Nested Ellipses

Items portrayed in this file

depicts

ellipse

creator

some value

Wikimedia username: Adam majewski
author name string: Adam majewski

copyright status

copyrighted

copyright license

Creative Commons Attribution-ShareAlike 4.0 International

source of file

original creation by uploader

inception

15 December 2020

MIME type

image/svg+xml

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current16:26, 24 February 2023Thumbnail for version as of 16:26, 24 February 20231,500 × 1,000 (2 KB)CmgleeMinimise by using <path> and searching for offsets minimising file size
12:08, 24 February 2023Thumbnail for version as of 12:08, 24 February 20231,500 × 1,000 (7 KB)CmgleeUse actual SVG ellipses
18:51, 23 February 2023Thumbnail for version as of 18:51, 23 February 20231,500 × 1,000 (22 KB)Mrmwlower filesize
17:15, 15 December 2020Thumbnail for version as of 17:15, 15 December 20201,500 × 1,000 (14.85 MB)Soul windsurferUploaded own work with UploadWizard
The following pages on the English Wikipedia use this file (pages on other projects are not listed):

Metadata