Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated constants in Cone #10

Closed
samreid opened this issue Aug 9, 2021 · 2 comments
Closed

Duplicated constants in Cone #10

samreid opened this issue Aug 9, 2021 · 2 comments
Assignees

Comments

@samreid
Copy link
Member

samreid commented Aug 9, 2021

During #5, I noticed some duplicated magic numbers in Cone:

 /**
   * Returns the radius from a general size scale
   * @public
   * @override
   *
   * @param {number} widthRatio
   * @returns {number}
   */
  static getRadiusFromRatio( widthRatio ) {
    return 0.01 + widthRatio * 0.09;
  }

  /**
   * Returns the height from a general size scale
   * @public
   * @override
   *
   * @param {number} heightRatio
   * @returns {number}
   */
  static getHeightFromRatio( heightRatio ) {
    return 2 * ( 0.01 + heightRatio * 0.09 );
  }

I also see a lot of 0.75 and 0.25 in this file. Should some of these constants be factored out and described?

@jonathanolson
Copy link
Contributor

The getRadiusFromRatio and getHeightFromRatio are not tied together, just happen to be similar. Otherwise I factored out constants. Can you review?

@samreid
Copy link
Member Author

samreid commented Aug 10, 2021

Looks good, thanks! Closing.

@samreid samreid closed this as completed Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants