We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to find the rotation matrix, we use the _calcRotateMatrix() method. This method returns an Array with given values [cosA, sinA, -sinA, cosA, 0, 0]; where A is the angle of rotation in degrees. Syntax _calcRotateMatrix(): Array Example 1: Using the _calcRotateMatrix ... Read More
In this tutorial, we will see to write a go language program to sort an array in ascending order. Sort An Array In Ascending Order Using A User-Defined Function The following code illustrates how we can sort an array of elements in ascending order in golang. Algorithm Step 1 − Import the fmt package. Step 2 − Define a function sortArray() to sort the given array. Step 3 − Pass arguments to sortArray() function one is the array of integers that we wish to sort and the other two variables are used to hold temporary values. Step ... Read More
We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. Syntax new fabric.Polygon( points: Array, options: Object ) Parameters points − This parameter accepts an Array which denotes the array of points that make up the polygon object. options (optional) − This parameter is an Object which provides additional customizations to our object. Using this ... Read More
In this tutorial, we will see to write a go language program to sort an array using three different methods. Sort An Array Of Integers Using User-Defined Functions The following code illustrates how we can sort an array of elements in golang using user-defined functions. Algorithm Step 1 − Importing the fmt package. Step 2 − Defining a function named sortArray() which will sort the given array. Step 3 − Pass the array to be sorted as an argument to this function. This function uses two for loops to iterate over the array. Step 4 − If ... Read More
We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. Syntax new fabric.Polygon( points: Array, options: Object ) Parameters points − This parameter accepts an Array which denotes the array of points that make up the polygon object. options (optional) − This parameter is an Object which provides additional customizations to our ... Read More
In this article, we will write a go language program to rotate given matrix element. Rotate A Matrix Using An External Function The following code illustrates rotating a matrix anticlockwise by 90 degrees any number of times. Algorithm Step 1 − Import the fmt package. Step 2 − Create a function to rotate the array elements. This function takes the array to be rotated as argument. Step 3 − Also pass the number of times the array is to be shifted as argument. Further, initialize an empty matrix to hold the final result. Step 4 − In ... Read More
We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. Syntax new fabric.Polygon( points: Array, options: Object ) Parameters points − This parameter accepts an Array which denotes the array of points that make up the polygon object. options (optional) − This parameter is an Object which provides additional customizations to our object. Using ... Read More
In this tutorial, we will see to write a go language program to remove duplicate elements from an array. By removing duplicate entries, we mean that we wish to write a program that will remove a value repeating multiple times. Remove Duplicate Values From An Array Using An External Function The following code illustrates how we can remove duplicate values from an array using a user-defined function. Algorithm Step 1 − First, we need to import the fmt package. Step 2 − Now, make a function named removeDuplicate() that accepts an array as an argument and returns an array ... Read More
We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. Since Polygon extends fabric.Polyline, we can create a polygon instance by using polyline as well. Syntax new fabric.Polyline( points: Array, options: Object ) Parameters points − This parameter accepts an Array which denotes the array of points that make up the polygon object ... Read More
In this tutorial, we will see to write a go language program to remove all occurrences of an element in an array. Removing occurrences from an array means that we wish to remove an entry completely from the array. Remove All Occurances Of An Element In An Array Using External Function The following code illustrates how we can remove all the occurrences of an element in an array by using a user-defined function. Algorithm Step 1 − Import the fmt package. Step 2 − Defining a function named removeOccurrence(). Step 3 − In this function, we are checking ... Read More