@wandelbots/wandelbots-js-react-components 1.46.4 → 1.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "1.46.4",
3
+ "version": "1.47.0",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -0,0 +1,40 @@
1
+ import { Line } from "@react-three/drei"
2
+ import type { GetTrajectoryResponse } from "@wandelbots/wandelbots-js"
3
+ import * as THREE from "three"
4
+
5
+ export type TrajectoryRendererProps = {
6
+ trajectory: GetTrajectoryResponse
7
+ } & JSX.IntrinsicElements["group"]
8
+
9
+ export function TrajectoryRenderer({
10
+ trajectory,
11
+ ...props
12
+ }: TrajectoryRendererProps) {
13
+ const points =
14
+ trajectory.trajectory
15
+ ?.map((point) => {
16
+ if (point.tcp_pose) {
17
+ return new THREE.Vector3(
18
+ point.tcp_pose.position.x / 1000,
19
+ point.tcp_pose.position.z / 1000,
20
+ -point.tcp_pose.position.y / 1000,
21
+ )
22
+ }
23
+ return null
24
+ })
25
+ .filter((point): point is THREE.Vector3 => point !== null) || []
26
+
27
+ return (
28
+ <group {...props}>
29
+ {points.length > 0 && (
30
+ <Line
31
+ points={points}
32
+ lineWidth={3}
33
+ polygonOffset={true}
34
+ polygonOffsetFactor={10}
35
+ polygonOffsetUnits={10}
36
+ />
37
+ )}
38
+ </group>
39
+ )
40
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./components/3d-viewport/PresetEnvironment"
2
2
  export * from "./components/3d-viewport/SafetyZonesRenderer"
3
+ export * from "./components/3d-viewport/TrajectoryRenderer"
3
4
  export * from "./components/jogging/JoggingCartesianAxisControl"
4
5
  export * from "./components/jogging/JoggingJointRotationControl"
5
6
  export * from "./components/jogging/JoggingPanel"