Code Monkey home page Code Monkey logo

coord's People

Contributors

hustcc avatar pearmini avatar pepper-nice avatar viruspc avatar xiaoiver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coord's Issues

连续矩阵的逆运算

现在将连续的矩阵运算的逆运算合并成一个函数存在问题,导致在有连续的仿射变换的时候不能 invert 到原始值。

polar.rho

因为 polar.rho 和 polar.theta 存在一些问题,同时他们的效果可以由 polar 所代替,所以把这部分删除。

feat: fisheye accepts abstract focus point instead of visual focus point

Currently fisheye accepts visual focus point, which means it must be specified after cartesian coordinate.

const coord = new Coordinate({
  width: 300,
  height: 150,
});
coord.transform('cartesian');
coord.transform('fisheye', 150, 75, 2, 2);
coord.map([0.4, 0.2]); // [85.71428571428571, 13.63636363636364]

This is inconsistent with other coordinate transformations, such as polar.

const coord = new Coordinate();
coord.transform('polar', -Math.PI / 2, (Math.PI * 3) / 2, 0, 1);
coord.transform('cartesian');

A better implementation is enabling fisheye to accept abstract focus point(normalized point).

const coord = new Coordinate({
  width: 300,
  height: 150,
});

// The first way to declare.
coord.transform('fisheye', 0.5, 0.5, 2, 2); // Abstract value by default.
coord.transform('cartesian');

// The second way to declare.
coord.transform('fisheye', 300, 150, 2, 2, true);  // Flag to treat it as visual value.
coord.transform('cartesian');

// Result the same.
coord.map([0.4, 0.2]); // [85.71428571428571, 13.63636363636364]

The key to achieving this goal is to pass [0, 1] for the range of fisheyeTransform, and normalize focusX before point transformations. - source

// Before
const fx = fisheyeTransform(vx, focusX, distortionX, x, x + width); // focusX is visual value.

// After
const normalizedFocusX = normlize(focusX, isVisual);
const fx = fisheyeTransform(vx, normalizedFocusX, distortionX, 0, 1); 

Todo List

  • fisheye - code, test, docs
  • fisheyeX - code, test, docs
  • fisheyeY - code, test, docs

helix map & invert

在 map 的时候 r = a + b * theta 中 b 的计算存在问题,同时在 invert 的时候不能计算出准确的 theta,到处并不能 invert 回去。

完善

  • 按照目前的设计,基类的 init() 方法完全可以直接在构造函数中编码,将 init() 方法作为抽象方法,由各个子类进行实现,而不是现在每个子类自己定义 _init() 方法
  • 添加更新坐标系范围的方法

[RFC] 通过代理的方式直接操作 options.transformations

@hustcc 使用方式如下:

案例1

const coord = new Coordinate();
coord.$unshift('scale');

和下面一样

const coord = new Coordinate();
const { transformations } = coord.getOptions();
transformations.unshift('scale');
coord.update({
  transformations
})

案例2

const len = new Coordinate().$length;

和下面一样

const len = new Coordinate().getOptions().transformations.length;

修改 Coordinate 设置默认 options 的方式

现在 Coordinate 设置默认 options 的方式是 constructor 里面赋值,更简洁的做法是在前面声明。

class A {
  a = 1;
  constructor() {
    console.log('a');
  }
}

@hustcc 上面的 ts 代码编译成 js 如下:

"use strict";
class A {
  constructor() {
    this.a = 1;
    console.log('a');
  }
}

仓库治理

请给这个 repo 一个稍微详细一点的 Description。

稍微细化一下 README,说一下这个 repo 是干什么的、大概被哪里依赖。

(如果是已经废弃的项目需要清理)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.