Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algorithm for README.md: [v1.1.0] #23

Open
YujiSODE opened this issue Mar 30, 2022 · 5 comments
Open

Algorithm for README.md: [v1.1.0] #23

YujiSODE opened this issue Mar 30, 2022 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@YujiSODE
Copy link
Owner

Algorithm for README.md

@YujiSODE YujiSODE added documentation Improvements or additions to documentation to_do To do labels Mar 30, 2022
@YujiSODE YujiSODE added this to the v1.1.0 milestone Mar 30, 2022
@YujiSODE YujiSODE self-assigned this Mar 30, 2022
@YujiSODE YujiSODE pinned this issue Mar 30, 2022
@YujiSODE
Copy link
Owner Author

YujiSODE commented Mar 30, 2022

Value in a sequence

A hexadecimal sequence: seq.
Length of this hexadecimal sequence: L.
An index for a value in this hexadecimal sequence: I := i%L, where i = 0,1,2, ....

A value in this sequence hex is expressed as follows:
hex = seq[I] = seq[i%L]

Global constants

  • midX = (target canvas width)*0.5
  • midY = (target canvas height)*0.5
  • R0 = max(midX,midY)*SQRT(2)
  • dT = π/100

@YujiSODE
Copy link
Owner Author

YujiSODE commented Mar 30, 2022

Function: arc(I)

arc(I) := {
	x=xO+r0*cos(t);
	y=yO+r0*sin(t)+r;
	draw(t = from T0 to T0 +2*π);
}

Local values in arc(I)

Color

Fill color: #rrggbbaa = #{seq[I]}{seq[(I+1)%L]}{seq[(I+2)%L]}{seq[(I+3)%L]}{seq[(I+4)%L]}{seq[(I+5)%L]}ff,
where (r,g,b,a) = 0,1, ...,e,f.

Values

  1. Direction and Radius for O := (xO, yO)

    • direction: direction = π*seq[I]/8 = 2*π*hex/16
    • radius: R = R0*(1.0+seq[(I+1)%L]/16)
  2. x and y

    • xO = midX +R*cos(direction)
    • yO = midY +R*sin(direction)
    • x = (target canvas width)*seq[(I+2)%L]/16
    • y = (target canvas height)*seq[(I+3)%L]/16
  3. Radius for arc(I) and T0

    • T0: initial angle between the positive x-axis and a vector (x-xO, y-yO)
    • radius: r0 = SQRT((x-xO)^2+(y-yO)^2)

@YujiSODE
Copy link
Owner Author

YujiSODE commented Mar 31, 2022

Changes of r in arc(I)

  • r = 0.0
  • T = dT
  • t = T0 +T
  • j = 1
while(T<2*π){
	idx = I+seq[I]*j;

	a0 = seq[idx%L];
	a1 = seq[(idx+1)%L];
	a2 = seq[(idx+2)%L];
	a3 = seq[(idx+3)%L];

	r += (a1-a0)*(a3-a2);

	x=xO+r0*cos(t);
	y=yO+r0*sin(t)+r;

	j += 1;
	T = j*dT;
	t = T0+T;
}

@YujiSODE
Copy link
Owner Author

YujiSODE commented Mar 31, 2022

Normal order

i = from 0 to L-1

i = 0;
while(i<L){
	arc(i);
	i+=1;
}

Reverse order

i = from L-1 to 0

i = L-1;
while(!(i<0)){
	arc(i);
	i+=-1;
}

@YujiSODE
Copy link
Owner Author

YujiSODE commented Mar 31, 2022

algorithm_arcLandscape
Result paths (blue) derives from given circle (dashed line) and value changes along y axis (red).

Repository owner locked and limited conversation to collaborators Apr 1, 2022
@YujiSODE YujiSODE removed the to_do To do label Apr 7, 2022
@YujiSODE YujiSODE changed the title Algorithm for README.md Algorithm for README.md: [v1.1.0] Apr 8, 2022
@YujiSODE YujiSODE unpinned this issue Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant