     else
       @bottomLeft().add @leftEdge().scale Math.map(n, p3, 1, 0, 1) * -1
 
+  # Returns the angle of the rectangle perimeter at the path position {Number}.
+  #
+  # <script>drawGeometry('rectangle', {paths: [0, 1/3, 2/3]})</script>
+  #
+  # n - A {Number} between `0` and `1`a {Number} between `0` and `1`.
+  # pathBasedOnLength - A {Boolean} of whether the position on the path
+  #                     consider the length of the path segments or not.
+  #                     When true, each segment will only weight as much
+  #                     as their own length.
+  #                     When false, every segment have the same weight,
+  #                     resulting in a difference in speed when animating
+  #                     an object along a path.
+  #
+  # Returns a {Number}.
   pathOrientationAt: (n, pathBasedOnLength=true) ->
     [p1,p2,p3] = @pathSteps pathBasedOnLength
 


  @alias 'rotate', 'rotateAroundCenter'

  scale: (scale) ->
    center = @center()
    @width *= scale

      .add(@topEdge().scale random.get())
      .add(@leftEdge().scale random.get())

  # Returns the length {Number} of the rectangle perimeter.
  #
  # Returns a {Number}.
  length: -> @width * 2 + @height * 2

  # Returns a [Point]{agt.geom.Point} on the rectangle perimeter using
  # a {Number} between `0` and `1`.
  #
  # <script>drawGeometry('rectangle', {paths: [0, 1/3, 2/3]})</script>
  #
  # n - A {Number} between `0` and `1`a {Number} between `0` and `1`.
  # pathBasedOnLength - A {Boolean} of whether the position on the path
  #                     consider the length of the path segments or not.
  #                     When true, each segment will only weight as much
  #                     as their own length.
  #                     When false, every segment have the same weight,
  #                     resulting in a difference in speed when animating
  #                     an object along a path.
  #
  # Returns a [Point]{agt.geom.Point}.
  pathPointAt: (n, pathBasedOnLength=true) ->
    [p1,p2,p3] = @pathSteps pathBasedOnLength

