Giter Site home page Giter Site logo

sakuraentropia / berry4d Goto Github PK

View Code? Open in Web Editor NEW

This project forked from link14349/berry4d

0.0 0.0 0.0 150 KB

This is a simple projection of four-dimensional objects into three-dimensional space, and then the projection objects are presented on the 2D screen.

License: Apache License 2.0

C++ 91.49% Python 6.13% CMake 2.38%

berry4d's Introduction

Berry4D

This is a simple projection of four-dimensional objects into three-dimensional space, and then the projection objects are presented on the 2D screen.
这是一个简单的将四维物体投影到三维空间中再将投影物体呈现在2D屏幕上的程序.

Foundations of Mathematics 一些数学基础理论推导

1. Coordinate system 坐标系设定:

xyz space

y   z
^  ^
| /
|/--> x

xyw space

y   w
^  ^
| /
|/--> x

xzw space

w   z
^  ^
| /
|/--> x

yzw space

y   z
^  ^
| /
|/--> w

2. Projection 投影

2.1 Camera Settings 相机设置

In camera coordinates, we set the camera to point in the positive direction of the w axis.
在相机坐标中,我们设定相机指向w轴正方向. The camera has three line of sight angles f_ x, f_ y, f_ z is used to describe half of the viewing angle of the camera in the x, y, z axes.
相机拥有三个视线角f_x, f_y, f_z用来描述相机在x, y, z轴方向上可观察范围角度的一半.

2.2 Projection: Perspective Projection 投影: 透视投影

\begin{cases}
x'=\frac{x}{w\tan f_a}\\
y'=\frac{y}{w\tan f_a}\\
z'=\frac{z}{w\tan f_a}
\end{cases}

3. Rotation 旋转

We remember R_t is the rotation matrix of θ that rotates clockwise about the t axis.
我们记R_t为绕t轴顺时针旋转θ的旋转矩阵

R_x=\left[\begin{array}{ccc}
1 & 0 & 0 & 0 \\
0 & \cos\theta & -\sin\theta & -\sin\theta \\
0 & \sin\theta & \cos\theta & \sin\theta \\
0 & \sin\theta & -\sin\theta & \cos\theta
\end{array}\right]
R_y=\left[\begin{array}{ccc}
\cos\theta & 0 & \sin\theta & \sin\theta \\
0 & 1 & 0 & 0 \\
-\sin\theta & 0 & \cos\theta & -\sin\theta \\
-\sin\theta & 0 & \sin\theta & \cos\theta
\end{array}\right]
R_z=\left[\begin{array}{ccc}
\cos\theta & -\sin\theta & 0 & -\sin\theta \\
\sin\theta & \cos\theta & 0 & \sin\theta \\
0 & 0 & 1 & 0 \\
\sin\theta & -\sin\theta & 0 & \cos\theta
\end{array}\right]
R_w=\left[\begin{array}{ccc}
\cos\theta & -\sin\theta & \sin\theta & 0 \\
\sin\theta & \cos\theta & -\sin\theta & 0 \\
-\sin\theta & \sin\theta & \cos\theta & 0 \\
0 & 0 & 0 & 1
\end{array}\right]

!!!: Note that the length of the column vector of this rotation matrix is greater than 1, which needs to be manually divided back, otherwise there will be amplification effect!
!!!: 注意,这个旋转矩阵的列向量长度大于1需要手动除回去否则会有放大效应!

berry4d's People

Contributors

link14349 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.