Skip to content

Commit 164cde6

Browse files
- More tweaks to implementations of setTo() for array types
- Updated testing
1 parent b0f7326 commit 164cde6

26 files changed

+226
-67
lines changed

main/boofcv-feature/src/test/java/boofcv/struct/feature/TestPackedTupleArray_B.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of BoofCV (http://boofcv.org).
55
*
@@ -20,6 +20,7 @@
2020

2121
import boofcv.struct.PackedArray;
2222
import boofcv.struct.packed.GenericPackedArrayChecks;
23+
import org.junit.jupiter.api.Test;
2324

2425
import static org.junit.jupiter.api.Assertions.assertEquals;
2526
import static org.junit.jupiter.api.Assertions.fail;
@@ -50,4 +51,7 @@ class TestPackedTupleArray_B extends GenericPackedArrayChecks<TupleDesc_B> {
5051
}
5152
fail("The tuples are identical");
5253
}
54+
55+
// not implemented yet
56+
@Test void setTo_Standard(){}
5357
}

main/boofcv-feature/src/test/java/boofcv/struct/feature/TestPackedTupleArray_F64.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of BoofCV (http://boofcv.org).
55
*
@@ -21,6 +21,7 @@
2121
import boofcv.struct.PackedArray;
2222
import boofcv.struct.packed.GenericPackedArrayChecks;
2323
import org.ejml.UtilEjml;
24+
import org.junit.jupiter.api.Test;
2425

2526
import static org.junit.jupiter.api.Assertions.assertEquals;
2627
import static org.junit.jupiter.api.Assertions.fail;
@@ -51,4 +52,7 @@ class TestPackedTupleArray_F64 extends GenericPackedArrayChecks<TupleDesc_F64> {
5152
}
5253
fail("The tuples are identical");
5354
}
55+
56+
// not implemented yet
57+
@Test void setTo_Standard(){}
5458
}

main/boofcv-feature/src/test/java/boofcv/struct/feature/TestPackedTupleArray_S8.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of BoofCV (http://boofcv.org).
55
*
@@ -20,6 +20,7 @@
2020

2121
import boofcv.struct.PackedArray;
2222
import boofcv.struct.packed.GenericPackedArrayChecks;
23+
import org.junit.jupiter.api.Test;
2324

2425
import static org.junit.jupiter.api.Assertions.assertEquals;
2526
import static org.junit.jupiter.api.Assertions.fail;
@@ -50,4 +51,7 @@ class TestPackedTupleArray_S8 extends GenericPackedArrayChecks<TupleDesc_S8> {
5051
}
5152
fail("The tuples are identical");
5253
}
54+
55+
// not implemented yet
56+
@Test void setTo_Standard(){}
5357
}

main/boofcv-feature/src/test/java/boofcv/struct/feature/TestPackedTupleArray_U8.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of BoofCV (http://boofcv.org).
55
*
@@ -20,6 +20,7 @@
2020

2121
import boofcv.struct.PackedArray;
2222
import boofcv.struct.packed.GenericPackedArrayChecks;
23+
import org.junit.jupiter.api.Test;
2324

2425
import static org.junit.jupiter.api.Assertions.assertEquals;
2526
import static org.junit.jupiter.api.Assertions.fail;
@@ -50,4 +51,7 @@ class TestPackedTupleArray_U8 extends GenericPackedArrayChecks<TupleDesc_U8> {
5051
}
5152
fail("The tuples are identical");
5253
}
54+
55+
// not implemented yet
56+
@Test void setTo_Standard(){}
5357
}

main/boofcv-feature/src/test/java/boofcv/struct/feature/TestPackedTupleBigArray_B.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of BoofCV (http://boofcv.org).
55
*
@@ -20,6 +20,7 @@
2020

2121
import boofcv.struct.PackedArray;
2222
import boofcv.struct.packed.GenericPackedArrayChecks;
23+
import org.junit.jupiter.api.Test;
2324

2425
import static org.junit.jupiter.api.Assertions.assertEquals;
2526
import static org.junit.jupiter.api.Assertions.fail;
@@ -50,4 +51,7 @@ class TestPackedTupleBigArray_B extends GenericPackedArrayChecks<TupleDesc_B> {
5051
}
5152
fail("The tuples are identical");
5253
}
54+
55+
// not implemented yet
56+
@Test void setTo_Standard(){}
5357
}

main/boofcv-feature/src/test/java/boofcv/struct/feature/TestPackedTupleBigArray_F64.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of BoofCV (http://boofcv.org).
55
*
@@ -21,6 +21,7 @@
2121
import boofcv.struct.PackedArray;
2222
import boofcv.struct.packed.GenericPackedArrayChecks;
2323
import org.ejml.UtilEjml;
24+
import org.junit.jupiter.api.Test;
2425

2526
import static org.junit.jupiter.api.Assertions.assertEquals;
2627
import static org.junit.jupiter.api.Assertions.fail;
@@ -51,4 +52,7 @@ class TestPackedTupleBigArray_F64 extends GenericPackedArrayChecks<TupleDesc_F64
5152
}
5253
fail("The tuples are identical");
5354
}
55+
56+
// not implemented yet
57+
@Test void setTo_Standard(){}
5458
}

main/boofcv-feature/src/test/java/boofcv/struct/feature/TestPackedTupleBigArray_S8.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of BoofCV (http://boofcv.org).
55
*
@@ -20,6 +20,7 @@
2020

2121
import boofcv.struct.PackedArray;
2222
import boofcv.struct.packed.GenericPackedArrayChecks;
23+
import org.junit.jupiter.api.Test;
2324

2425
import static org.junit.jupiter.api.Assertions.assertEquals;
2526
import static org.junit.jupiter.api.Assertions.fail;
@@ -50,4 +51,7 @@ class TestPackedTupleBigArray_S8 extends GenericPackedArrayChecks<TupleDesc_S8>
5051
}
5152
fail("The tuples are identical");
5253
}
54+
55+
// not implemented yet
56+
@Test void setTo_Standard(){}
5357
}

main/boofcv-feature/src/test/java/boofcv/struct/feature/TestPackedTupleBigArray_U8.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2024, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of BoofCV (http://boofcv.org).
55
*
@@ -20,6 +20,7 @@
2020

2121
import boofcv.struct.PackedArray;
2222
import boofcv.struct.packed.GenericPackedArrayChecks;
23+
import org.junit.jupiter.api.Test;
2324

2425
import static org.junit.jupiter.api.Assertions.assertEquals;
2526
import static org.junit.jupiter.api.Assertions.fail;
@@ -50,4 +51,7 @@ class TestPackedTupleBigArray_U8 extends GenericPackedArrayChecks<TupleDesc_U8>
5051
}
5152
fail("The tuples are identical");
5253
}
54+
55+
// not implemented yet
56+
@Test void setTo_Standard(){}
5357
}

main/boofcv-types/src/main/java/boofcv/struct/packed/PackedArrayPoint2D_F64.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import boofcv.misc.BoofLambdas;
2222
import boofcv.struct.PackedArray;
2323
import georegression.struct.point.Point2D_F64;
24+
import lombok.Getter;
2425
import org.ddogleg.struct.DogArray_F64;
2526

2627
/**
@@ -31,10 +32,11 @@
3132
public class PackedArrayPoint2D_F64 implements PackedArray<Point2D_F64> {
3233
private static final int DOF = 2;
3334

34-
// Stores tuple in a single continuous array
35-
public final DogArray_F64 array;
35+
/** Stores tuple in a single continuous array */
36+
@Getter private final DogArray_F64 array;
37+
3638
// tuple that the result is temporarily written to
37-
public final Point2D_F64 temp = new Point2D_F64();
39+
private final Point2D_F64 temp = new Point2D_F64();
3840

3941
public PackedArrayPoint2D_F64() {
4042
array = new DogArray_F64();
@@ -108,9 +110,7 @@ public final void append( double x, double y ) {
108110
* @return Reference to 'this'
109111
*/
110112
public PackedArrayPoint2D_F64 setTo( PackedArrayPoint2D_F64 src ) {
111-
reset();
112-
reserve(src.size());
113-
src.forIdx(0, src.size(), ( idx, p ) -> append(p.x, p.y));
113+
array.setTo(src.array);
114114
return this;
115115
}
116116
}

main/boofcv-types/src/main/java/boofcv/struct/packed/PackedArrayPoint2D_I16.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import boofcv.misc.BoofLambdas;
2222
import boofcv.struct.PackedArray;
2323
import georegression.struct.point.Point2D_I16;
24+
import lombok.Getter;
2425
import org.ddogleg.struct.DogArray_I16;
2526

2627
/**
@@ -31,10 +32,11 @@
3132
public class PackedArrayPoint2D_I16 implements PackedArray<Point2D_I16> {
3233
private static final int DOF = 2;
3334

34-
// Stores tuple in a single continuous array
35-
public final DogArray_I16 array;
35+
/** Stores tuple in a single continuous array */
36+
@Getter private final DogArray_I16 array;
37+
3638
// tuple that the result is temporarily written to
37-
public final Point2D_I16 temp = new Point2D_I16();
39+
private final Point2D_I16 temp = new Point2D_I16();
3840

3941
public PackedArrayPoint2D_I16() {
4042
array = new DogArray_I16();
@@ -108,9 +110,7 @@ public final void append( int x, int y ) {
108110
* @return Reference to 'this'
109111
*/
110112
public PackedArrayPoint2D_I16 setTo( PackedArrayPoint2D_I16 src ) {
111-
reset();
112-
reserve(src.size());
113-
src.forIdx(0, src.size(), ( idx, p ) -> append(p.x, p.y));
113+
array.setTo(src.array);
114114
return this;
115115
}
116116
}

main/boofcv-types/src/main/java/boofcv/struct/packed/PackedArrayPoint2D_I32.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import boofcv.misc.BoofLambdas;
2222
import boofcv.struct.PackedArray;
2323
import georegression.struct.point.Point2D_I32;
24+
import lombok.Getter;
2425
import org.ddogleg.struct.DogArray_I32;
2526

2627
/**
@@ -31,10 +32,11 @@
3132
public class PackedArrayPoint2D_I32 implements PackedArray<Point2D_I32> {
3233
private static final int DOF = 2;
3334

34-
// Stores tuple in a single continuous array
35-
public final DogArray_I32 array;
35+
/** Stores tuple in a single continuous array */
36+
@Getter private final DogArray_I32 array;
37+
3638
// tuple that the result is temporarily written to
37-
public final Point2D_I32 temp = new Point2D_I32();
39+
private final Point2D_I32 temp = new Point2D_I32();
3840

3941
public PackedArrayPoint2D_I32() {
4042
array = new DogArray_I32();
@@ -108,9 +110,7 @@ public final void append( int x, int y ) {
108110
* @return Reference to 'this'
109111
*/
110112
public PackedArrayPoint2D_I32 setTo( PackedArrayPoint2D_I32 src ) {
111-
reset();
112-
reserve(src.size());
113-
src.forIdx(0, src.size(), ( idx, p ) -> append(p.x, p.y));
113+
array.setTo(src.array);
114114
return this;
115115
}
116116
}

main/boofcv-types/src/main/java/boofcv/struct/packed/PackedArrayPoint3D_F64.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import boofcv.misc.BoofLambdas;
2222
import boofcv.struct.PackedArray;
2323
import georegression.struct.point.Point3D_F64;
24+
import lombok.Getter;
2425
import org.ddogleg.struct.DogArray_F64;
2526

2627
/**
@@ -31,10 +32,11 @@
3132
public class PackedArrayPoint3D_F64 implements PackedArray<Point3D_F64> {
3233
private static final int DOF = 3;
3334

34-
// Stores tuple in a single continuous array
35-
public final DogArray_F64 array;
35+
/** Stores tuple in a single continuous array */
36+
@Getter private final DogArray_F64 array;
37+
3638
// tuple that the result is temporarily written to
37-
public final Point3D_F64 temp = new Point3D_F64();
39+
private final Point3D_F64 temp = new Point3D_F64();
3840

3941
public PackedArrayPoint3D_F64() {
4042
array = new DogArray_F64();
@@ -118,9 +120,7 @@ public void append( double x, double y, double z) {
118120
* @return Reference to 'this'
119121
*/
120122
public PackedArrayPoint3D_F64 setTo( PackedArrayPoint3D_F64 src ) {
121-
reset();
122-
reserve(src.size());
123-
src.forIdx(0, src.size(), ( idx, p ) -> append(p.x, p.y, p.z));
123+
array.setTo(src.array);
124124
return this;
125125
}
126126
}

main/boofcv-types/src/main/java/boofcv/struct/packed/PackedArrayPoint4D_F64.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import boofcv.misc.BoofLambdas;
2222
import boofcv.struct.PackedArray;
2323
import georegression.struct.point.Point4D_F64;
24+
import lombok.Getter;
2425
import org.ddogleg.struct.DogArray_F64;
2526

2627
/**
@@ -31,10 +32,11 @@
3132
public class PackedArrayPoint4D_F64 implements PackedArray<Point4D_F64> {
3233
private static final int DOF = 4;
3334

34-
// Stores tuple in a single continuous array
35-
public final DogArray_F64 array;
35+
/** Stores tuple in a single continuous array */
36+
@Getter private final DogArray_F64 array;
37+
3638
// tuple that the result is temporarily written to
37-
public final Point4D_F64 temp = new Point4D_F64();
39+
private final Point4D_F64 temp = new Point4D_F64();
3840

3941
public PackedArrayPoint4D_F64() {
4042
array = new DogArray_F64();
@@ -125,9 +127,7 @@ public void append( double x, double y, double z, double w ) {
125127
* @return Reference to 'this'
126128
*/
127129
public PackedArrayPoint4D_F64 setTo( PackedArrayPoint4D_F64 src ) {
128-
reset();
129-
reserve(src.size());
130-
src.forIdx(0, src.size(), ( idx, p ) -> append(p.x, p.y, p.z, p.w));
130+
array.setTo(src.array);
131131
return this;
132132
}
133133
}

main/boofcv-types/src/main/java/boofcv/struct/packed/PackedBigArrayPoint2D_F64.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class PackedBigArrayPoint2D_F64 implements PackedArray<Point2D_F64> {
3636
private final BigDogArray_F64 dog;
3737

3838
// tuple that the result is temporarily written to
39-
public final Point2D_F64 temp = new Point2D_F64();
39+
private final Point2D_F64 temp = new Point2D_F64();
4040

4141
/**
4242
* Constructor where the default is used for all parameters.

main/boofcv-types/src/main/java/boofcv/struct/packed/PackedBigArrayPoint3D_F64.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class PackedBigArrayPoint3D_F64 implements PackedArray<Point3D_F64> {
3636
private static final int DOF = 3;
3737

3838
// tuple that the result is temporarily written to
39-
public final Point3D_F64 temp = new Point3D_F64();
39+
private final Point3D_F64 temp = new Point3D_F64();
4040

4141
// Storage for the raw data in an array
4242
private final BigDogArray_F64 dog;

0 commit comments

Comments
 (0)