From 85d89fb136c6942a163bff5092c774a6c288d8e7 Mon Sep 17 00:00:00 2001 From: Bhavya Dhiman Date: Sat, 30 May 2020 10:27:05 +0530 Subject: [PATCH] Paperjs: update documentation on Mathematical Operations point1 + point2 returning NaN but point1.add(point2) is returning valid value. same case for subtrction, multiplication and division --- .../mathematical-operations/index.html | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tutorials/geometry/mathematical-operations/index.html b/tutorials/geometry/mathematical-operations/index.html index c4338789..5923c864 100644 --- a/tutorials/geometry/mathematical-operations/index.html +++ b/tutorials/geometry/mathematical-operations/index.html @@ -74,24 +74,24 @@

Mathematical Operations

// Create a second point that is 4 times the first one. // This is the same as creating a new point with x and y // of point1 multiplied by 4: -var point2 = point1 * 4; +var point2 = point1.multiply(4); console.log(point2); // { x: 40, y: 80 } // Now we calculate the difference between the two. -var point3 = point2 - point1; +var point3 = point2.subtract(point1); console.log(point3); // { x: 30, y: 60 } // Create yet another point, with a numeric value added to point3: -var point4 = point3 + 30; +var point4 = point3.add(30); console.log(point4); // { x: 60, y: 90 } // How about a third of that? -var point5 = point4 / 3; +var point5 = point4.divide(3); console.log(point5); // { x: 20, y: 30 } // Multiplying two points with each other multiplies each // coordinate seperately -var point6 = point5 * new Point(3, 2); +var point6 = point5.multiply(new Point(3, 2)); console.log(point6); // { x: 60, y: 60 }

@@ -99,20 +99,20 @@

Mathematical Operations

 var point1 = new Point(10, 20);
-var point2 = point1 + { x: 100, y: 100 };
+var point2 = point1.add({ x: 100, y: 100 });
 console.log(point2); // { x: 110, y: 120 }
 
 // Adding size objects to points work too,
 // forcing them to be converted to a point first
-var point3 = point2 + new Size(50, 100);
+var point3 = point2.add(new Size(50, 100));
 console.log(point3); // { x: 160, y: 220 }
 
 // And using the object notation for size works just as well:
-var point4 = point3 + { width: 40, height: 80 };
+var point4 = point3.add({ width: 40, height: 80 });
 console.log(point4); // { x: 200, y: 300 }
 
 // How about adding a point in array notation instead?
-var point5 = point4 + [100, 0];
+var point5 = point4.add([100, 0]);
 console.log(point5); // { x: 300, y: 300 }
 

Math Functions

@@ -141,11 +141,11 @@

Mathematical Operations

 // Create a point whose x is between 0 and 50,
 // and y is between 0 and 100
-var point = new Point(50, 100) * Point.random();
+var point = new Point(50, 100).multiply(Point.random());
 
 // Create a size whose width is between 0 and 50,
 // and height is between 0 and 100
-var size = new Size(50, 100) * Size.random();
+var size = new Size(50, 100).multiply(Size.random());