@@ -59,10 +59,19 @@ type RandomizeArrayNodeData struct {
5959 ScaleMaximum nodes.Output [vector3.Float64 ]
6060 RotationMinimum nodes.Output [vector3.Float64 ]
6161 RotationMaximum nodes.Output [vector3.Float64 ]
62- Samples nodes.Output [int ]
62+ Array nodes.Output [[] TRS ]
6363}
6464
6565func (tnd RandomizeArrayNodeData ) Out () nodes.StructOutput [[]TRS ] {
66+ if tnd .Array == nil {
67+ return nodes.NewStructOutput [[]TRS ](nil )
68+ }
69+
70+ input := tnd .Array .Value ()
71+ if len (input ) == 0 {
72+ return nodes.NewStructOutput [[]TRS ](nil )
73+ }
74+
6675 minT := nodes .TryGetOutputValue (tnd .TranslationMinimum , vector3 .Zero [float64 ]())
6776 maxT := nodes .TryGetOutputValue (tnd .TranslationMaximum , vector3 .Zero [float64 ]())
6877 rangeT := maxT .Sub (minT )
@@ -75,9 +84,9 @@ func (tnd RandomizeArrayNodeData) Out() nodes.StructOutput[[]TRS] {
7584 maxR := nodes .TryGetOutputValue (tnd .RotationMaximum , vector3 .Zero [float64 ]())
7685 rangeR := maxR .Sub (minR )
7786
78- samples := make ([]TRS , max ( nodes . TryGetOutputValue ( tnd . Samples , 0 ), 0 ))
79- for i := range samples {
80- samples [ i ] = New (
87+ out := make ([]TRS , len ( input ))
88+ for i := range out {
89+ sample : = New (
8190 minT .Add (vector3 .New (
8291 rangeT .X ()* rand .Float64 (),
8392 rangeT .Y ()* rand .Float64 (),
@@ -88,16 +97,16 @@ func (tnd RandomizeArrayNodeData) Out() nodes.StructOutput[[]TRS] {
8897 rangeR .Y ()* rand .Float64 (),
8998 rangeR .Z ()* rand .Float64 (),
9099 ))),
91- // quaternion.Identity(),
92100 minS .Add (vector3 .New (
93101 rangeS .X ()* rand .Float64 (),
94102 rangeS .Y ()* rand .Float64 (),
95103 rangeS .Z ()* rand .Float64 (),
96104 )),
97105 )
106+ out [i ] = input [i ].Multiply (sample )
98107 }
99108
100- return nodes .NewStructOutput (samples )
109+ return nodes .NewStructOutput (out )
101110}
102111
103112// ============================================================================
0 commit comments