diff --git a/src/App.tsx b/src/App.tsx index 1ee5347..6ee670f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,15 +1,25 @@ import { Canvas } from "@react-three/fiber"; -import { OrbitControls } from "@react-three/drei"; +import { + OrbitControls, + OrthographicCamera, + type OrbitControlsChangeEvent, +} from "@react-three/drei"; import styles from "./styles.module.scss"; import "katex/dist/katex.min.css"; import Point from "./components/Point"; import Path from "./components/Path"; import { SettingsBox } from "./SettingsContext"; +import { useCallback, useState } from "react"; +import { atom, useAtom } from "jotai"; +import { Euler, type Matrix4 } from "three"; // https://threejs.org/manual/#en/align-html-elements-to-3d function App() { + const [rotationMatrix, setRotationMatrix] = useState( + undefined, + ); let coords: [number, number, number][] = [ [0, 0, 0], [0, 0, 1], @@ -35,11 +45,48 @@ function App() { a3 <= b3, ); + const orbitChange = useCallback((evt?: OrbitControlsChangeEvent) => { + // if (evt) setRotation(evt.target.object.rotation); + console.log(evt?.target.object.toJSON()); + setRotationMatrix(evt?.target.object.matrix); + }, []); + return (
+
+ + + + + +
- + + +