Giter VIP home page Giter VIP logo

Comments (15)

ItsNickBarry avatar ItsNickBarry commented on July 21, 2024

What do you mean by "self.distance"?

from hyperbolic-canvas.

x13machine avatar x13machine commented on July 21, 2024

I meant var point = Point.givenHyperbolicPolarCoordinates(this.distanceFromCenter() - distance,this.distanceFromCenter() > distance?thisAngle:angle);

//there's a bug when you do something like this with the current code:

p1.distantPoint(200.0,Math.PI).distantPoint(100.0,0.0);
// or something like this
p1.distantPoint(100.0,0.0).distantPoint(200.0,Math.PI);

from hyperbolic-canvas.

x13machine avatar x13machine commented on July 21, 2024

I was converting your code and changing it and there was a bug like that.

from hyperbolic-canvas.

x13machine avatar x13machine commented on July 21, 2024

https://github.com/ItsNickBarry/hyperbolic-canvas/blob/gh-pages/lib/Line.js#L82 There's a useless Math.abs()

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on July 21, 2024

Ha, looks like both calls to Math.abs() are useless. Fixed with dfc35ec.

from hyperbolic-canvas.

x13machine avatar x13machine commented on July 21, 2024

now fix the first bug. This library is poorly designed

from hyperbolic-canvas.

x13machine avatar x13machine commented on July 21, 2024

This library should use polar coordinates for the coordinates instead of poincare coordinates because like all the algorithms are converting back and forth all the time. Using Polar Coordinates instead of Poincaire Coordinates would increase performance.

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on July 21, 2024

I'm working on it. Your suggested solution doesn't work any better.

I'm not sure how using polar coordinates would help with this. It's a hyperbolic library, so it's going to have hyperbolic calculations. Can you be more specific, or provide documentation?

from hyperbolic-canvas.

x13machine avatar x13machine commented on July 21, 2024

https://github.com/ItsNickBarry/hyperbolic-canvas/blob/gh-pages/lib/Point.js#L29

distantPoint basically does poincare coordinates -> polar coordinates -> math -> polar coordinates -> poincare coordinates.

from hyperbolic-canvas.

x13machine avatar x13machine commented on July 21, 2024

A bunch of functions are like that

from hyperbolic-canvas.

x13machine avatar x13machine commented on July 21, 2024

There would be a performance increase because the library wouldn't be converting poincare coordinates and polar coordinates all the time. just only at render time

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on July 21, 2024

When you say "Poincare" coordinates, do you mean "Euclidean"?

from hyperbolic-canvas.

x13machine avatar x13machine commented on July 21, 2024

I think. I dunno whatever new Point({x:0.5,y:0.5}) uses.

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on July 21, 2024

Yes, those are the Euclidean coordinates. You do have a point about the performance issues, and I'll work on that when I have a chance. For now, I will prioritize the issues with distantPoint.

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on July 21, 2024

I'm not entirely sure what your original problem was, but I've fixed a problem that occurred when using polar coordinates with a negative radius.

All of the classes now store their instance variables privately: this._x instead of this.x. These variables should be retrieved using the new getter methods: this.getX().

When appropriate, these variables are not calculated until the getter is called. This includes the x and y coordinates of a Point.

from hyperbolic-canvas.

Related Issues (12)

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.