Advertisement
5_2007-2008 Miscellaneous #176928

Rotation of points in 3D

This code rotates a point around another in 3D using simple fast code. It does this using x, y, z coordinates, cosine and sine. It is 100% accurate.

AI

Tóm tắt bởi AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Mã nguồn
original-source
'For best results define variables as doubles
'The angle of rotation is in Radians, view this in
'your VB help file and it will tell you how to
'convert degrees into radians
'Rotation around x-axis
 newx = oldx
 newy = (sin(angle) * oldz) + (cos(angle) * oldy)
 newz = (cos(angle) * oldz) - (sin(angle) * oldy)
'Rotation around y-axis
 newx = (cos(angle) * oldx) - (sin(angle) * oldz)
 newy = oldy
 newz = (sin(angle) * oldx) + (cos(angle) * oldz)
'Rotation around z-axis
 newx = (cos(angle) * oldx) + (sin(angle) * oldy)
 newy = (cos(angle) * oldy) - (sin(angle) * oldx)
 newz = oldz
'PS - If you have any problems with
'this please either
'e-mail me at:
'TheVBGod@Hotmail.com 
'or post a comment below
' -- Thank You --
Bình luận gốc (3)
Được khôi phục từ Wayback Machine