Last active
May 16, 2019 12:58
-
-
Save anuraghazra/cfcf10a184d21d076c03b3cd9d7d281e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stick { | |
constructor(p1, p2, length) { | |
this.startPoint = p1; | |
this.endPoint = p2; | |
this.stiffness = 2; | |
this.color = '#f5476a'; | |
// if the length is not given then calculate the distance based on position | |
if (!length) { | |
this.length = this.startPoint.pos.dist(this.endPoint.pos); | |
} else { | |
this.length = length; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment