Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

rotate a vector

function rotate(angle: number) {
        this.angle += angle
        this.x = Math.cos(this.angle) * this.length
        this.y = Math.sin(this.angle) * this.length
}
Comment

Rotate Vector by an angle

var rotateVector = function(vec, ang)
{
    ang = -ang * (Math.PI/180);
    var cos = Math.cos(ang);
    var sin = Math.sin(ang);
    return new Array(Math.round(10000*(vec[0] * cos - vec[1] * sin))/10000, Math.round(10000*(vec[0] * sin + vec[1] * cos))/10000);
};
Comment

PREVIOUS NEXT
Code Example
Java :: android studio remove navigation bar 
Java :: java binary search tree 
Java :: /= java 
Java :: how to set edittext color in android 
Java :: query spring boot 
Java :: varargs java 
Java :: arraylist add method 
Java :: char to charsequence in java 
Java :: class syntax in java 
Java :: multiple return values in function java 
Java :: when does black jack happens 
Java :: casting in java 
Java :: Java Filters 
Java :: calling a method in java 
Java :: loop through array in java 
Java :: Java if Keyword 
Java :: print outputstream to console java 
Java :: print prime numbers in java 
Java :: how to calculate min, max and average and write the output into into a text file in java 
Sql :: how to get the size of the database in postgresql 
Sql :: sql find text in sp 
Sql :: sql disable trigger 
Sql :: kill mysql processlist in whose time more than 200 
Sql :: get tables in database sql 
Sql :: sql server get users 
Sql :: mysql change database charset and collation 
Sql :: mysql first day of year 
Sql :: select users 
Sql :: import sql mysql ubuntu 
Sql :: mysql last 6 months 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =