Giter VIP home page Giter VIP logo

Comments (10)

ItsNickBarry avatar ItsNickBarry commented on August 22, 2024

The radius provided to Polygon.fromNCenterRadius is a hyperbolic distance. Each vertex of the generated Polygon is that distance away from the provided center point. In this model of the hyperbolic plane, the edge of the unit circle represents a point at infinity, so any distance < infinity will fit within the circle.

Does that make sense?

I haven't decided yet whether I will include functions to create Euclidean polygons.

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on August 22, 2024

Actually, that's not entirely true. Polygon.fromVertices can be used to define polygons using Euclidean points. Polygon.fromNCenterRadius is used to generate regular polygons on the hyperbolic plane.

from hyperbolic-canvas.

x13machine avatar x13machine commented on August 22, 2024

so is (1,1) like (infinity,infinity) in hyperbolic space

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on August 22, 2024

Sort of. I'm not aware of any hyperbolic coordinate system, but (1,1) is an infinite distance away from (0,0).

from hyperbolic-canvas.

x13machine avatar x13machine commented on August 22, 2024

does hyperbolic-canvas use some sort of hyperbolic coordinate system?

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on August 22, 2024

No. The Points are defined with standard coordinates relative to the unit circle. Given two Points, hyperbolic straight lines can be drawn, and hyperbolic distances can be calculated. Given one Point, a second Point, a specified hyperbolic distance away in a specified direction, can be found.

When generating Points, it might be more intuitive to use the Point.fromPolarCoordinates and Point.fromHyperbolicPolarCoordinates factory methods.

from hyperbolic-canvas.

x13machine avatar x13machine commented on August 22, 2024

on a pseudo-hyperbolic-coordinate system what would (0.5,0.5) be? how would you convert from the Euclidean-coordinate system to the pseudo-hyperbolic-coordinate

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on August 22, 2024

I don't know. As far as the canvas is concerned, (.5, .5) is just (.5, .5). You can get more information about the nature of the point, in a hyperbolic sense, from the instance functions.

var point = Point.fromCoordinates(.5, .5);

// get hyperbolic distance from center
var distance = point.distanceFromCenter();

// get angle of point relative the unit circle
var angle = point.angle();

// regenerate the same point using hyperbolic information (though point.equals(newPoint) might be false due to floating point rounding error
var newPoint = Point.fromHyperbolicPolarCoordinates(distance, angle);

from hyperbolic-canvas.

x13machine avatar x13machine commented on August 22, 2024

I figured that I could use 2 * Math.atanh(a) and Math.tanh(a/2) to convert between them.

from hyperbolic-canvas.

ItsNickBarry avatar ItsNickBarry commented on August 22, 2024

I use 2 * Math.atanh(a) to calculate Point.distanceFromCenter, where a is the Euclidean distance from the center.

Math.tanh(a/2), where a is the hyperbolic distance from the center, would return the Euclidean distance from the center.

This is useful, but I don't believe it can be used to generate any sort of (x, y) coordinates. In the Cartesian coordinate system, x and y represent distances from the y and x axes, respectively. On the hyperbolic plane, I don't think distance from an axis and distance from the center can be calculated in the same way.

I could be wrong. I'll look into it.

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.