mattdesl / mattdesl/glo

data types: arrays or objects

Open
#2 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
25
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Things like Vector, Color, Matrix4, etc.

It can be super frustrating dealing with code that looks like this:

``` js
tmp[0] = 5
tmp[1] = 0
tmp[2] = 0
obj.translate(tmp)

//or
vec3.add(obj.position, obj.position, somethingElse)
```

Instead of:

``` js
tmp.set(x, y, z)
obj.translate(tmp)

//or
obj.translate(somethingElse)
```

However.. array types have a lot of benefits including:
- code re-use; the end goal here is not to create yet another ThreeJS monolith and I don't want to support/maintain custom data types for matrices, quaternions, etc
- scope creep; there is no fear of scope creep since new features can be built independently of the framework and its data types (like [mat4-interpolate](https://www.npmjs.com/package/mat4-interpolate))
- more functional, allows stuff like `filter` / `slice` / `map`
- n-dimensional algorithms using for loops (e.g. [lerp-array](https://www.npmjs.com/package/lerp-array))
- the dimensionality is intrinsic -- `vec[0]` is accessing the 0th component. this is quite elegant mathematically
- better composition with other modules; most npm modules use arrays for the above reasons

So I think array types for all these structures is still the best way to go.

But maybe since this is a fairly opinionated "frameworky" tool, there can be some middle ground that has a nicer UX.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Read the issue discussion about Vector, Color, and Matrix4 representations first, then identify the affected data-type APIs and establish a decided representation and usage pattern before implementation can begin.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.