≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Bug in Vect3d.js
Posted by:
(you are not logged in)
Enter the missing letter in: "Internati?nal"
(you are not logged in)
Text:
[quote][b][/b] wrote: Here is the code to handle rotating about a center (copied from irrlicht). [code] /** * Rotates the vector around XY by a specic angle and center * @public */ CL3D.Vect3d.prototype.rotateXYBy = function(degrees, center) { degrees *= CL3D.DEGTORAD; var cs = Math.cos(degrees); var sn = Math.sin(degrees); if (center) { this.X -= center.X; this.Y -= center.Y; } var oldX = this.X var oldY = this.Y this.X = oldX*cs - oldY*sn; this.Y = oldX*sn + oldY*cs; if (center) { this.X += center.X; this.Y += center.Y; } } /** * Rotates the vector around YZ by a specic angle and center * @public */ CL3D.Vect3d.prototype.rotateYZBy = function(degrees, center) { degrees *= CL3D.DEGTORAD; var cs = Math.cos(degrees); var sn = Math.sin(degrees); if (center) { this.Z -= center.Z; this.Y -= center.Y; } var oldY = this.Y var oldZ = this.Z this.Y = oldY*cs - oldZ*sn; this.Z = oldY*sn + oldZ*cs; if (center) { this.Z += center.Z; this.Y += center.Y; } } /** * Rotates the vector around XZ by a specic angle and center * @public */ CL3D.Vect3d.prototype.rotateXZBy = function(degrees, center) { degrees *= CL3D.DEGTORAD; var cs = Math.cos(degrees); var sn = Math.sin(degrees); if (center) { this.X -= center.X; this.Z -= center.Z; } var oldX = this.X var oldZ = this.Z this.X = oldX*cs - oldZ*sn; this.Z = oldX*sn + oldZ*cs; if (center) { this.X += center.X; this.Z += center.Z; } } [/code][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact