Prepare phd in typst
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// Computes the aspect ratio of the window.
|
||||
let aspectRatio = window.innerWidth / window.innerHeight;
|
||||
|
||||
// Creates a camera and sets its parameters and position.
|
||||
let camera = new THREE.PerspectiveCamera(70, aspectRatio, 0.01, 10);
|
||||
camera.position.z = 1;
|
||||
|
||||
// Creates the scene that contains our objects.
|
||||
let scene = new THREE.Scene();
|
||||
|
||||
// Creates a geometry (vertices and faces) corresponding to a cube.
|
||||
let geometry = new THREE.BoxGeometry(0.2, 0.2, 0.2);
|
||||
|
||||
// Creates a material that paints the faces depending on their normal.
|
||||
let material = new THREE.MeshNormalMaterial();
|
||||
|
||||
// Creates a mesh that associates the geometry with the material.
|
||||
let mesh = new THREE.Mesh(geometry, material);
|
||||
|
||||
// Adds the mesh to the scene.
|
||||
scene.add(mesh);
|
||||
|
||||
// Creates the renderer and append its canvas to the DOM.
|
||||
renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
// Renders the scene with the camera.
|
||||
renderer.render(scene, camera);
|
||||
@@ -0,0 +1,10 @@
|
||||
error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
|
||||
--> src/main.rs:4:9
|
||||
|
|
||||
3 | for value in &vec {
|
||||
| ----
|
||||
| |
|
||||
| immutable borrow occurs here
|
||||
| immutable borrow later used here
|
||||
4 | vec.push(*value);
|
||||
| ^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
||||
@@ -0,0 +1,3 @@
|
||||
auto vec = std::vector<int> {1, 2, 3};
|
||||
for (auto it = std::begin(vec); it < std::end(vec); it++)
|
||||
vec.push_back(*it);
|
||||
@@ -0,0 +1,8 @@
|
||||
let mut vec = vec![1, 2, 3];
|
||||
let iter = vec.iter();
|
||||
loop {
|
||||
match iter.next() {
|
||||
Some(x) => vec.push(x),
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
auto vec = std::vector<int> {1, 2, 3};
|
||||
for (auto value: vec)
|
||||
vec.push_back(value);
|
||||
@@ -0,0 +1,4 @@
|
||||
let mut vec = vec![1, 2, 3];
|
||||
for value in &vec {
|
||||
vec.push(value);
|
||||
}
|
||||
Reference in New Issue
Block a user