@@ -55,25 +55,32 @@ export class Measurement {
5555 const min = this . _box . min ;
5656 const max = this . _box . max ;
5757
58- // Create dimension lines for X, Y, and Z axes
59- this . createDimensionLine (
60- new THREE . Vector3 ( min . x , min . y , min . z ) ,
61- new THREE . Vector3 ( max . x , min . y , min . z ) ,
62- 'X' ,
63- size . x
64- ) ;
65- this . createDimensionLine (
66- new THREE . Vector3 ( max . x , min . y , min . z ) ,
67- new THREE . Vector3 ( max . x , max . y , min . z ) ,
68- 'Y' ,
69- size . y
70- ) ;
71- this . createDimensionLine (
72- new THREE . Vector3 ( max . x , max . y , min . z ) ,
73- new THREE . Vector3 ( max . x , max . y , max . z ) ,
74- 'Z' ,
75- size . z
76- ) ;
58+ // Create dimension lines only for dimensions with a size greater than a small epsilon.
59+ // This is useful for hiding zero-dimension measurements for 2D objects like edges.
60+ if ( size . x > 1e-6 ) {
61+ this . createDimensionLine (
62+ new THREE . Vector3 ( min . x , min . y , min . z ) ,
63+ new THREE . Vector3 ( max . x , min . y , min . z ) ,
64+ 'X' ,
65+ size . x
66+ ) ;
67+ }
68+ if ( size . y > 1e-6 ) {
69+ this . createDimensionLine (
70+ new THREE . Vector3 ( max . x , min . y , min . z ) ,
71+ new THREE . Vector3 ( max . x , max . y , min . z ) ,
72+ 'Y' ,
73+ size . y
74+ ) ;
75+ }
76+ if ( size . z > 1e-6 ) {
77+ this . createDimensionLine (
78+ new THREE . Vector3 ( max . x , max . y , min . z ) ,
79+ new THREE . Vector3 ( max . x , max . y , max . z ) ,
80+ 'Z' ,
81+ size . z
82+ ) ;
83+ }
7784
7885 // The annotations are created for an axis-aligned box at the origin, so transform
7986 // the group to match the object's actual position and orientation (if provided).
0 commit comments