-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
70 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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位置 |
This file was deleted.
Oops, something went wrong.