Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PackedArray #435

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ subprojects {

dependencies {
api("org.georegression:georegression:0.27.3") { exclude group: 'org.ddogleg' }
api("org.ddogleg:ddogleg:0.23.4")
api("org.ddogleg:ddogleg:0.23.5-SNAPSHOT")

api("net.sf.trove4j:trove4j:${project.trove4j_version}")

Expand Down
7 changes: 7 additions & 0 deletions change.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ Version Meaning: <compatible>.<feature>.<bug fix>
- Second digit indicates if a new feature was added and/or if only a minor refactoring has been done
- Last digit always indicates a bug fix and other minor changes

---------------------
Date : 202X/XXX/XX
Version : 1.1.8

- PackedArray
* Added isEquals()

---------------------
Date : 2024/Oct/05
Version : 1.1.7
Expand Down
6 changes: 3 additions & 3 deletions integration/boofcv-kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
id 'org.jetbrains.kotlin.jvm' version '1.7.22'
}

configurations.all {
resolutionStrategy {
force "org.jetbrains:annotations:$project.jetnull_version"
force "org.jetbrains.kotlin:kotlin-stdlib:1.6.10"
force "org.jetbrains.kotlin:kotlin-stdlib-common:1.6.10"
force "org.jetbrains.kotlin:kotlin-stdlib:1.7.22"
force "org.jetbrains.kotlin:kotlin-stdlib-common:1.7.22"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package boofcv.struct.feature;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import org.ddogleg.struct.DogArray_I32;

/**
Expand Down Expand Up @@ -99,6 +100,10 @@ public PackedTupleArray_B( int dof ) {
}
}

@Override public boolean isEquals( PackedArray<TupleDesc_B> other ) {
return array.isEquals(((PackedTupleArray_B)other).array);
}

@Override public int getDOF() {
return dof;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package boofcv.struct.feature;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import org.ddogleg.struct.DogArray_F64;

/**
Expand Down Expand Up @@ -95,6 +96,10 @@ public PackedTupleArray_F64( int dof ) {
}
}

@Override public boolean isEquals( PackedArray<TupleDesc_F64> other ) {
return array.isEquals(((PackedTupleArray_F64)other).array);
}

@Override public int getDOF() {
return dof;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package boofcv.struct.feature;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import org.ddogleg.struct.DogArray_I8;

/**
Expand Down Expand Up @@ -95,6 +96,10 @@ public PackedTupleArray_S8( int dof ) {
}
}

@Override public boolean isEquals( PackedArray<TupleDesc_S8> other ) {
return array.isEquals(((PackedTupleArray_S8)other).array);
}

@Override public int getDOF() {
return dof;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package boofcv.struct.feature;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import org.ddogleg.struct.DogArray_I8;

/**
Expand Down Expand Up @@ -95,6 +96,10 @@ public PackedTupleArray_U8( int dof ) {
}
}

@Override public boolean isEquals( PackedArray<TupleDesc_U8> other ) {
return array.isEquals(((PackedTupleArray_U8)other).array);
}

@Override public int getDOF() {
return dof;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package boofcv.struct.feature;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import org.ddogleg.struct.BigDogArray_I32;
import org.ddogleg.struct.BigDogGrowth;

Expand Down Expand Up @@ -100,6 +101,10 @@ public PackedTupleBigArray_B( int dof ) {
});
}

@Override public boolean isEquals( PackedArray<TupleDesc_B> other ) {
return array.isEquivalent(((PackedTupleBigArray_B)other).array);
}

@Override public int getDOF() {
return dof;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package boofcv.struct.feature;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import org.ddogleg.struct.BigDogArray_F64;
import org.ddogleg.struct.BigDogGrowth;

Expand Down Expand Up @@ -96,6 +97,10 @@ public PackedTupleBigArray_F64( int dof ) {
});
}

@Override public boolean isEquals( PackedArray<TupleDesc_F64> other ) {
return array.isEquivalent(((PackedTupleBigArray_F64)other).array, 0.0);
}

@Override public int getDOF() {
return dof;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package boofcv.struct.feature;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import org.ddogleg.struct.BigDogArray_I8;
import org.ddogleg.struct.BigDogGrowth;

Expand Down Expand Up @@ -96,6 +97,10 @@ public PackedTupleBigArray_S8( int dof ) {
});
}

@Override public boolean isEquals( PackedArray<TupleDesc_S8> other ) {
return array.isEquivalent(((PackedTupleBigArray_S8)other).array);
}

@Override public int getDOF() {
return dof;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package boofcv.struct.feature;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import org.ddogleg.struct.BigDogArray_I8;
import org.ddogleg.struct.BigDogGrowth;

Expand Down Expand Up @@ -96,6 +97,10 @@ public PackedTupleBigArray_U8( int dof ) {
});
}

@Override public boolean isEquals( PackedArray<TupleDesc_U8> other ) {
return array.isEquivalent(((PackedTupleBigArray_U8)other).array);
}

@Override public int getDOF() {
return dof;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public static class Packed2D implements PackedArray<Point2D_F64> {
@Override public void append( Point2D_F64 element ) {list.add(element.copy());}
@Override public void set(int index, Point2D_F64 element) {}
@Override public void forIdx( int idx0, int idx1, BoofLambdas.ProcessIndex<Point2D_F64> op ) {}
@Override public boolean isEquals(PackedArray<Point2D_F64> other) {return false;}
@Override public Point2D_F64 getTemp( int index ) {return list.get(index);}
@Override public void getCopy( int index, Point2D_F64 dst ) {dst.setTo(list.get(index));}
@Override public void copy( Point2D_F64 src, Point2D_F64 dst ) {dst.setTo(src);}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ public interface PackedArray<T> extends LArrayAccessor<T> {
* @param op The operation to process each element
*/
void forIdx( int idx0, int idx1, BoofLambdas.ProcessIndex<T> op );

/** Checks to see if the two data structures are equal */
boolean isEquals( PackedArray<T> other );
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,19 @@
package boofcv.struct.packed;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import georegression.struct.point.Point2D_F64;
import lombok.Getter;
import org.ddogleg.struct.DogArray_F64;

/**
* Packed array of {@link Point2D_F64}. Internally the point is stored in an interleaved format.
*
* @author Peter Abeles
*/
public class PackedArrayPoint2D_F64 implements PackedArray<Point2D_F64> {
private static final int DOF = 2;

/** Stores tuple in a single continuous array */
@Getter private final DogArray_F64 array;

public class PackedArrayPoint2D_F64 extends PackedArray_F64<Point2D_F64> {
// tuple that the result is temporarily written to
private final Point2D_F64 temp = new Point2D_F64();

public PackedArrayPoint2D_F64() {
array = new DogArray_F64();
array.resize(0);
}

@Override public void reset() {
array.reset();
}

@Override public void reserve( int numTuples ) {
array.reserve(numTuples*2);
super(2, 0);
}

public final void append( double x, double y ) {
Expand Down Expand Up @@ -82,10 +65,6 @@ public final void append( double x, double y ) {
dst.setTo(src);
}

@Override public int size() {
return array.size/2;
}

@Override public Class<Point2D_F64> getElementType() {
return Point2D_F64.class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public final void append( int x, int y ) {
}
}

@Override public boolean isEquals( PackedArray<Point2D_I16> o ) {
return this.array.isEquals(((PackedArrayPoint2D_I16)o).array);
}

/**
* Makes this array have a value identical to 'src'
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public final void append( int x, int y ) {
}
}

@Override public boolean isEquals( PackedArray<Point2D_I32> o ) {
return this.array.isEquals(((PackedArrayPoint2D_I32)o).array);
}

/**
* Makes this array have a value identical to 'src'
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,19 @@
package boofcv.struct.packed;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import georegression.struct.point.Point3D_F64;
import lombok.Getter;
import org.ddogleg.struct.DogArray_F64;

/**
* Packed array of {@link Point3D_F64}. Internally the point is stored in an interleaved format.
*
* @author Peter Abeles
*/
public class PackedArrayPoint3D_F64 implements PackedArray<Point3D_F64> {
private static final int DOF = 3;

/** Stores tuple in a single continuous array */
@Getter private final DogArray_F64 array;

public class PackedArrayPoint3D_F64 extends PackedArray_F64<Point3D_F64> {
// tuple that the result is temporarily written to
private final Point3D_F64 temp = new Point3D_F64();

public PackedArrayPoint3D_F64() {
array = new DogArray_F64();
array.resize(0);
}

@Override public void reset() {
array.reset();
}

@Override public void reserve( int numTuples ) {
array.reserve(numTuples*2);
super(3, 0);
}

@Override public void append( Point3D_F64 element ) {
Expand Down Expand Up @@ -90,10 +73,6 @@ public void append( double x, double y, double z) {
dst.setTo(src);
}

@Override public int size() {
return array.size/3;
}

@Override public Class<Point3D_F64> getElementType() {
return Point3D_F64.class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,19 @@
package boofcv.struct.packed;

import boofcv.misc.BoofLambdas;
import boofcv.struct.PackedArray;
import georegression.struct.point.Point4D_F64;
import lombok.Getter;
import org.ddogleg.struct.DogArray_F64;

/**
* Packed array of {@link Point4D_F64}. Internally the point is stored in an interleaved format.
*
* @author Peter Abeles
*/
public class PackedArrayPoint4D_F64 implements PackedArray<Point4D_F64> {
private static final int DOF = 4;

/** Stores tuple in a single continuous array */
@Getter private final DogArray_F64 array;

public class PackedArrayPoint4D_F64 extends PackedArray_F64<Point4D_F64> {
// tuple that the result is temporarily written to
private final Point4D_F64 temp = new Point4D_F64();

public PackedArrayPoint4D_F64() {
array = new DogArray_F64();
array.resize(0);
super(4, 0);
}

@Override public void reset() {
Expand Down Expand Up @@ -95,10 +86,6 @@ public void append( double x, double y, double z, double w ) {
dst.setTo(src);
}

@Override public int size() {
return array.size/4;
}

@Override public Class<Point4D_F64> getElementType() {
return Point4D_F64.class;
}
Expand Down
Loading
Loading