Skip to content

Commit

Permalink
6/2
Browse files Browse the repository at this point in the history
  • Loading branch information
Wcowin committed Jun 2, 2024
1 parent 33aa01c commit 4746e93
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .cache/plugin/git-committers/page-authors.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"cache_date": "2024-05-29", "page_authors": {}}
{"cache_date": "2024-06-02", "page_authors": {}}
Empty file added Icon
Empty file.
10 changes: 7 additions & 3 deletions docs/blog/posts/update2024.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ categories:
- 网站更新记录
readtime: 2
---
## </p><h1 id="01" name="01"><strong>2024-06-2</strong></h1><p>
* 优化网站流畅度(玄学)
* 过了六一
* [甜甜圈代码🍩](../technique%20sharing/ttq.md)

## </p><h1 id="01" name="01"><strong>2024-05-15</strong></h1><p>
* 优化网站流畅度(玄学)
Expand Down Expand Up @@ -77,7 +81,7 @@ if (typeof document$ !== "undefined") {
* 优化网站流畅度(玄学)
* 看了更多的猫咪
* 优化布局
* 新增圆角化设计教程
* 新增[圆角化设计教程](../websitebeauty/yuanjiaohua.md)

## </p><h1 id="01" name="01"><strong>2024-04-22</strong></h1><p>
* 优化网站流畅度(玄学)
Expand All @@ -101,9 +105,9 @@ if (typeof document$ !== "undefined") {
## </p><h1 id="01" name="01"><strong>2024-04-02</strong></h1><p>
* 优化网站流畅度(玄学)
* 在mkdocs.yml的plugins模块中引入`!ENV [CI, false]`语句,极大缩短`mkdocs serve`静态预览时间(3-5s)
* 本Mkdocs-Wcowin主题得到以下两位的使用
* 本Mkdocs-Wcowin主题案例
- [Lenny's Web](https://lennychen.top)
- [tkqtang's Web](https://tkqtang.site/)


## </p><h1 id="01" name="01"><strong>2024-03-14</strong></h1><p>
* 优化网站流畅度(玄学)
Expand Down
84 changes: 84 additions & 0 deletions docs/blog/technique sharing/ttq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: 甜甜圈代码🍩
# 隐藏的模块
hide:
# - navigation # 隐藏左边导航
# - toc #隐藏右边导航
# - footer #隐藏翻页
# - feedback #隐藏反馈
tags:
- 技术分享
comments: false #评论,默认不开启
---

[![image.gif](https://i.postimg.cc/ryGZvqbN/image.gif)](https://postimg.cc/HjxtM1Tr)

代码如下
```c title="math.py"
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#define R(mul,shift,x,y) \
_=x; \
x -= mul*y>>shift; \
y += mul*_>>shift; \
_ = 3145728-x*x-y*y>>11; \
x = x*_>>10; \
y = y*_>>10;

int8_t b[1760], z[1760];

int main() {
int sA=1024,cA=0,sB=1024,cB=0,_;
for (;;) {
memset(b, 32, 1760); // text buffer
memset(z, 127, 1760); // z buffer
int sj=0, cj=1024;
for (int j = 0; j < 90; j++) {
int si = 0, ci = 1024; // sine and cosine of angle i
for (int i = 0; i < 324; i++) {
int R1 = 1, R2 = 2048, K2 = 5120*1024;

int x0 = R1*cj + R2,
x1 = ci*x0 >> 10,
x2 = cA*sj >> 10,
x3 = si*x0 >> 10,
x4 = R1*x2 - (sA*x3 >> 10),
x5 = sA*sj >> 10,
x6 = K2 + R1*1024*x5 + cA*x3,
x7 = cj*si >> 10,
x = 40 + 30*(cB*x1 - sB*x4)/x6,
y = 12 + 15*(cB*x4 + sB*x1)/x6,
N = (-cA*x7 - cB*((-sA*x7>>10) + x2) - ci*(cj*sB >> 10) >> 10) - x5 >> 7;

int o = x + 80 * y;
int8_t zz = (x6-K2)>>15;
if (22 > y && y > 0 && x > 0 && 80 > x && zz < z[o]) {
z[o] = zz;
b[o] = ".,-~:;=!*#$@"[N > 0 ? N : 0];
}
R(5, 8, ci, si) // rotate i
}
R(9, 7, cj, sj) // rotate j
}
for (int k = 0; 1761 > k; k++)
putchar(k % 80 ? b[k] : 10);
R(5, 7, cA, sA);
R(5, 8, cB, sB);
usleep(15000);
printf("\x1b[23A");
}
}
```

然后
`gcc math.c -o math`

`./math`

感兴趣的可以去研究背后的数学知识,地址:[donut.c without a math library](https://www.a1k0n.net/2021/01/13/optimizing-donut.html)

3 changes: 3 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,6 @@ ____ __ ____ ______ ______ ____ __ ____ __ .__ __.
-->

<!-- <iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/3tRns5xuEZ29Z0nd7ADdNk?utm_source=generator&theme=0" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
<iframe src="https://www.geogebra.org/calculator/budmqnft?embed" width="800" height="600" allowfullscreen style="border: 1px solid #e4e4e4;border-radius: 4px;" frameborder="0"></iframe> -->
Binary file added math
Binary file not shown.
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ theme:
# font:
# text: Bitter
# code: Roboto Mono
logo: https://s1.imagehub.cc/images/2024/02/02/91a767e93d1a344e44c69936464c583e.png
logo: https://i.postimg.cc/RVk3KzS2/Cravatar-modified.png
#https://s1.imagehub.cc/images/2024/02/02/91a767e93d1a344e44c69936464c583e.png
# https://s2.loli.net/2024/02/01/gaE47y5fKM6kosV.png
favicon: https://s2.loli.net/2024/04/06/yEOZavwMr6kTWhu.png
palette:
Expand Down Expand Up @@ -77,6 +78,7 @@ nav:
- 主页: index.md
- 技术:
- 好用/好玩网站分享: blog/Webplay.md
- 甜甜圈🍩代码: blog/technique sharing/ttq.md
- Mac/windows软件网站汇总: blog/macsoft.md
- 语雀: blog/yuque.md
- Telegram 群组、频道、机器人 汇总分享: blog/TG.md
Expand Down
Binary file added ttq
Binary file not shown.
56 changes: 56 additions & 0 deletions ttq.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#define R(mul,shift,x,y) \
_=x; \
x -= mul*y>>shift; \
y += mul*_>>shift; \
_ = 3145728-x*x-y*y>>11; \
x = x*_>>10; \
y = y*_>>10;

int8_t b[1760], z[1760];

int main() {
int sA=1024,cA=0,sB=1024,cB=0,_;
for (;;) {
memset(b, 32, 1760); // text buffer
memset(z, 127, 1760); // z buffer
int sj=0, cj=1024;
for (int j = 0; j < 90; j++) {
int si = 0, ci = 1024; // sine and cosine of angle i
for (int i = 0; i < 324; i++) {
int R1 = 1, R2 = 2048, K2 = 5120*1024;

int x0 = R1*cj + R2,
x1 = ci*x0 >> 10,
x2 = cA*sj >> 10,
x3 = si*x0 >> 10,
x4 = R1*x2 - (sA*x3 >> 10),
x5 = sA*sj >> 10,
x6 = K2 + R1*1024*x5 + cA*x3,
x7 = cj*si >> 10,
x = 40 + 30*(cB*x1 - sB*x4)/x6,
y = 12 + 15*(cB*x4 + sB*x1)/x6,
N = (-cA*x7 - cB*((-sA*x7>>10) + x2) - ci*(cj*sB >> 10) >> 10) - x5 >> 7;

int o = x + 80 * y;
int8_t zz = (x6-K2)>>15;
if (22 > y && y > 0 && x > 0 && 80 > x && zz < z[o]) {
z[o] = zz;
b[o] = ".,-~:;=!*#$@"[N > 0 ? N : 0];
}
R(5, 8, ci, si) // rotate i
}
R(9, 7, cj, sj) // rotate j
}
for (int k = 0; 1761 > k; k++)
putchar(k % 80 ? b[k] : 10);
R(5, 7, cA, sA);
R(5, 8, cB, sB);
usleep(15000);
printf("\x1b[23A");
}
}

0 comments on commit 4746e93

Please sign in to comment.