Skip to content

Commit 4897cf2

Browse files
author
David Braun
committed
optimization
1 parent 833475f commit 4897cf2

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

MatrixCHOP/MatrixCHOP.cpp

+3-11
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,9 @@ MatrixCHOP::execute(CHOP_Output* output,
178178

179179
float* p = theMat.multByVector(theVec);
180180

181-
p[0] /= p[3];
182-
p[1] /= p[3];
183-
p[2] /= p[3];
184-
185-
p[0] = .5 + p[0] * .5;
186-
p[1] = .5 + p[1] * .5;
187-
p[2] = .5 + p[2] * .5;
188-
189-
output->channels[0][i] = p[0];
190-
output->channels[1][i] = p[1];
191-
output->channels[2][i] = p[2];
181+
output->channels[0][i] = .5 + .5 * p[0] / p[3];
182+
output->channels[1][i] = .5 + .5 * p[1] / p[3];
183+
output->channels[2][i] = .5 + .5 * p[2] / p[3];
192184
}
193185

194186
}

MatrixCHOP/Plugins/MatrixCHOP.dll

0 Bytes
Binary file not shown.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ In this image we render a white rectangle at an oblique angle. The MatrixCHOP ta
1616
[Build the dll yourself](https://docs.derivative.ca/Write_a_CPlusPlus_Plugin), or use a compiled DLL file. `MatrixCHOP/MatrixCHOP/Plugins/MatrixCHOP.dll` has been compiled as a [Custom Operator](https://docs.derivative.ca/Custom_Operators) for TouchDesigner 2019.19160.
1717

1818
## Changelog
19+
* 2019-09-27 Optimization
1920
* 2019-09-19 Public release

0 commit comments

Comments
 (0)