Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lmj01 committed Nov 6, 2023
1 parent 472c6f9 commit b51b819
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 20 deletions.
28 changes: 28 additions & 0 deletions cg/canvas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Canvas

> 既然是图形库,那一定使用了很多图形学的技术
## path

- [Cocoa Drawing Guide, Paths苹果关于winding rules to path](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Paths/Paths.html)

**非零环绕数规则Non-Zero Winding Number Rule和奇偶规则Odd-even Rule**

> 在图形学中判断一个点是否在多边形内,若多边形不是自相交的,那么可以简单的判断这个点在多边形内部还是外部;若多边形是自相交的,那么就需要根据非零环绕数规则或奇偶规则来判断了
判断自相交,多边形在平面内的除顶点外还有其他公共点

### Non-Zero Winding Number Rule
使多边形的边变成矢量,将环绕数初始化为0,从该点p做任意方向的一条射线,当从p点沿射线方向移动时,对在每个方向上穿过射线的边计数,当多边形的边从左到右穿过射线时,环绕数加1,从右到左时,环绕数减1.遍历完多边形所有相关边之后,若环绕数非零,则p为内部点interior,否则为外部点。

### Odd-even Rule
从该点p任意方向的一条射线,若与该射线相交的多边形边数的数目为奇数,则p是多边形内部点,否则是外部点。即奇数在内,偶数在外。

图形是否填充就需要Even-Odd Rule和winding Rule结合来判断
```js
/**
*
*/
CanvasRenderingContext2D.isPointInPath()
```
[Applying winding rules to a path](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Art/winding_path_crossing_2x.png)
21 changes: 21 additions & 0 deletions cg/mesh-generation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 网格划分

## AFT(Advancing Front Technology)
> 算法实现可参考《Finite Element Mesh Generation》3.6节
核心思想是将边界离散为短边Generation front,然后以每一条短边为基准Base,在区域内找到一个最优的点,形成最优的三角形,同时更新短边的集合,直到集合中的所有短边都被处理。


## Delaunay三角剖分
可对给定的任意离散点集,做最优的三角化。所谓最优就是得到的所有三角形的最小的内角最大。
> Delaunay三角化的前提是要有一组离散的点集,可采样栅格法,就是在图形区域内用等距离的平行线与图形边界求交点,在交点间产生点。
其增量算法的主要步骤
- 生成一个包含有限点集的超三角或四边形
- 插入一个点,生成三角形
- 检查三角形是否合法,如不合法做flip,保证集合里的所有三角形都是Delaunay三角形
- 重复前面两步,插入所有点
- 删除与超三角形或四边形顶点相连的所有三角形

## 参考
- [Half-edge structure](https://kaba.hilvi.org/homepage/blog/halfedge/halfedge.htm)
2 changes: 2 additions & 0 deletions index/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## dev-note
- [git](../dev-note/git.md)
- [svn](../dev-note/svn.md)
- [cmake](../dev-note/cmake.md)
- [linux](../dev-note/linux.md)
- [ssh](../dev-note/ssh.md)
Expand All @@ -24,6 +25,7 @@

#### [nodejs](../nodejs/index.md)
- [测试模块](../nodejs/test.md)
- [vue](../nodejs/vue.md)
- [npm](../nodejs/npm.md)
- [pnpm](../nodejs/pnpm.md)
- [图像处理](../nodejs/ImageManipulation.md)
Expand Down
14 changes: 2 additions & 12 deletions index/computerScience.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
- [lua](../cpl/lua.md)
- [Java](../java/Java.md)

### Dev

- [CMD](../dev-note/cmd.md)
- [cmake](../dev-note/cmake.md)
- [git](../dev-note/git.md)
- [svn](../dev-note/svn.md)
- [wsl](../dev-note/wsl.md)

### Database

- [database](../database/database.md)
Expand Down Expand Up @@ -48,6 +40,8 @@
- [github](https://github.com/Pomax/bezierjs)

### 网格与CAD
- [HalfEdge半边结构](../cg/half-edge.md)
- [网格划分](../cg/mesh-generation.md)
- [GMesh]()
- [Triangulate Efficient Triangulation Algorithm Suitable for Terrain Modelling or An Algorithm for Interpolating Irregularly-Spaced Data with Applications in Terrain Modelling](http://paulbourke.net/papers/triangulate/)
- [多边形网格算法](http://paulbourke.net/geometry/polygonmesh/)
Expand Down Expand Up @@ -110,10 +104,6 @@
- [github](https://github.com/Paul180297/BezierLightLTC)
- [Real-Time Polygonal-Light Shading with Linearly Transformed Cosines](https://eheitzresearch.wordpress.com/415-2/)

## Web

- [Web notes](../web/index.md)

## AI
- [模型](../ai/model.md)

Expand Down
6 changes: 6 additions & 0 deletions index/online.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@
## 工具

### 文档

- [msdn](https://learn.microsoft.com/zh-cn/)
- [个人关于微软的开发文档](https://msdn.itellyou.cn/)
- [MDN Web Docs](https://developer.mozilla.org/en-US/)
- [HandWiki is a wiki encyclopedia for collaborative editing of articles on computing, science, technology and general knowledge](https://handwiki.org/wiki/Start)


### 在线工具
- [在线计算器及工具](https://www.rapidtables.org/zh-CN/)

Expand Down
11 changes: 11 additions & 0 deletions nodejs/vue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Vue
> 一种前端开发框架,较小的框架
## 关键流程

页面url变化刷新内容
```js
window.addEventListener('hashchange', initial, false);
```

Vue3.0新增了一个组件Teleport组件,将其所在组件模板内容内容移动到特定的DOM位置
8 changes: 0 additions & 8 deletions web/vue.md

This file was deleted.

0 comments on commit b51b819

Please sign in to comment.