google / google/codeworld

Constructive geometry

未关闭
#28 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
discussion
主要语言
Haskell
星标
1.3k
派生
201
PR 合并指标
30 天内没有已合并 PR

描述

Additional operations should be added to combine shapes:

```
intersection :: [Picture] -> Picture
difference :: Picture -> Picture -> Picture
```

(Names are debatable.) `intersection` should produce a picture bounded by the intersection of the list. The second should produce a picture containing all areas of the first image that are not also in the second. Note that together with the existing `pictures`, this gives the three basic operations for constructive geometry.

The implementation is a little tricky. Combining two images in this way can be done with globalCompositeOperation (https://developer.mozilla.org/samples/canvas-tutorial/6_1_canvas_composite.html) But getting the resulting shapes to nest correctly will involve using off-screen canvases as temporaries. Since creating a new off-screen canvas is expensive, this should involve determining the minimum number of offscreen canvases needed, and reusing them between frames.

贡献指南

打开贡献指南

调研方向

首先定位现有的 `pictures` 实现和 canvas 渲染入口点,然后检查 `globalCompositeOperation` 与离屏 canvas 如何组合嵌套形状。确定 `intersection` 和 `difference` 所需的最少可复用临时 canvas 数量;当这两个操作都能生成指定的构造几何区域,且不会在每一帧不必要地创建 canvas 时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
haskell, javascript
领域
computer-graphics
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。