11import React from "react" ;
22import { Config } from "../../config" ;
3- import { Line } from "@react-three/drei" ;
4- import { Group } from "../../components" ;
3+ import { Box , Edges } from "@react-three/drei" ;
4+ import { Group , MeshBasicMaterial } from "../../components" ;
55import {
66 threeSpace ,
77 zero as zeroFunc ,
8- extents as extentsFunc ,
9- zZero as zZeroFunc ,
108 zDir as zDirFunc ,
119} from "../../helpers" ;
1210import { DistanceIndicator } from "../../elements" ;
11+ import { BackSide } from "three" ;
1312
1413export interface BoundsProps {
1514 config : Config ;
@@ -19,33 +18,33 @@ export const Bounds = (props: BoundsProps) => {
1918 const {
2019 bedLengthOuter, bedWidthOuter, x, y, z,
2120 zAxisLength, columnLength, beamLength, bounds,
22- bedXOffset, bedYOffset,
21+ bedXOffset, bedYOffset, botSizeX , botSizeY , botSizeZ ,
2322 } = props . config ;
24- const zZero = zZeroFunc ( props . config ) ;
2523 const zDir = zDirFunc ( props . config ) ;
2624 const zero = zeroFunc ( props . config ) ;
27- const extents = extentsFunc ( props . config ) ;
28- const zDip = ( x : number , y : number ) : [ number , number , number ] [ ] => [
29- [ x , y , extents . z ] ,
30- [ x , y , zero . z ] ,
31- [ x , y , extents . z ] ,
32- ] ;
3325 return < Group name = { "bounds-and-distances" } >
34- < Line name = { "bounds" }
26+ < Box name = { "bounds" }
3527 visible = { bounds }
36- color = { "white" }
37- points = { [
38- [ zero . x , zero . y , zero . z ] ,
39- [ zero . x , extents . y , zero . z ] ,
40- [ extents . x , extents . y , zero . z ] ,
41- [ extents . x , zero . y , zero . z ] ,
42- [ zero . x , zero . y , zero . z ] ,
43- ...zDip ( zero . x , zero . y ) ,
44- ...zDip ( zero . x , extents . y ) ,
45- ...zDip ( extents . x , extents . y ) ,
46- ...zDip ( extents . x , zero . y ) ,
47- [ zero . x , zero . y , extents . z ] ,
48- ] } />
28+ position = { [
29+ zero . x + botSizeX / 2 ,
30+ zero . y + botSizeY / 2 ,
31+ zero . z - botSizeZ / 2 ,
32+ ] }
33+ args = { [
34+ botSizeX ,
35+ botSizeY ,
36+ botSizeZ ,
37+ ] } >
38+ < MeshBasicMaterial
39+ side = { BackSide }
40+ depthWrite = { false }
41+ transparent = { true }
42+ opacity = { 0 } />
43+ < Edges
44+ lineWidth = { 1.1 }
45+ color = { "white" }
46+ threshold = { 1 } />
47+ </ Box >
4948 < Group visible = { props . config . zDimension } >
5049 < DistanceIndicator
5150 start = { {
@@ -56,7 +55,7 @@ export const Bounds = (props: BoundsProps) => {
5655 end = { {
5756 x : threeSpace ( 0 , bedLengthOuter ) ,
5857 y : threeSpace ( bedWidthOuter , bedWidthOuter ) ,
59- z : zZero - z + zAxisLength ,
58+ z : zero . z - z + zAxisLength ,
6059 } } />
6160 </ Group >
6261 < Group visible = { props . config . distanceIndicator == "beamLength" } >
@@ -90,12 +89,12 @@ export const Bounds = (props: BoundsProps) => {
9089 start = { {
9190 x : threeSpace ( x + 100 , bedLengthOuter ) + bedXOffset ,
9291 y : threeSpace ( y , bedWidthOuter ) + bedYOffset ,
93- z : zZero - zDir * z ,
92+ z : zero . z - zDir * z ,
9493 } }
9594 end = { {
9695 x : threeSpace ( x + 100 , bedLengthOuter ) + bedXOffset ,
9796 y : threeSpace ( y , bedWidthOuter ) + bedYOffset ,
98- z : zZero - zDir * z + zAxisLength ,
97+ z : zero . z - zDir * z + zAxisLength ,
9998 } } />
10099 </ Group >
101100 </ Group > ;
0 commit comments