_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q177600 | Intersection2D_F64.containTriangle | test | public static boolean containTriangle( Point2D_F64 a , Point2D_F64 b , Point2D_F64 c , Point2D_F64 pt )
{
boolean ret = false;
if ( ((a.y>pt.y) != (b.y>pt.y)) && (pt.x < (b.x-a.x) * (pt.y-a.y) / (b.y-a.y) + a.x) )
ret = true;
if ( ((b.y>pt.y) != (c.y>pt.y)) && (pt.x < (c.x-b.x) * (pt.y-b.y) / (c.y-b.y) + b.... | java | {
"resource": ""
} |
q177601 | Intersection2D_F64.intersection | test | public static Point2D_F64 intersection( LineParametric2D_F64 a, LineParametric2D_F64 b , Point2D_F64 ret ) {
double t_b = a.getSlopeX() * ( b.getY() - a.getY() ) - a.getSlopeY() * ( b.getX() - a.getX() );
double bottom = a.getSlopeY() * b.getSlopeX() - b.getSlopeY() * a.getSlopeX();
if( bottom == 0 )
return n... | java | {
"resource": ""
} |
q177602 | Intersection2D_F64.intersection | test | public static Point2D_F64 intersection( LineSegment2D_F64 l_0, LineSegment2D_F64 l_1,
Point2D_F64 ret ) {
double a0 = l_0.b.x - l_0.a.x;
double b0 = l_0.b.y - l_0.a.y;
double a1 = l_1.b.x - l_1.a.x;
double b1 = l_1.b.y - l_1.a.y;
double top = b0 * ( l_1.a.x - l_0.a.x ) + a0 * ( l_0.a.y - l_1.a.y ... | java | {
"resource": ""
} |
q177603 | Intersection2D_F64.intersection | test | public static Point2D_F64 intersection( Point2D_F64 lineA0 , Point2D_F64 lineA1 ,
Point2D_F64 lineB0 , Point2D_F64 lineB1 ,
Point2D_F64 output )
{
if( output == null )
output = new Point2D_F64();
double slopeAx = lineA1.x - lineA0.x;
double slopeAy = lineA1.y - lineA0.y;
double slopeB... | java | {
"resource": ""
} |
q177604 | Intersection2D_F64.intersection | test | public static double intersection( LineParametric2D_F64 target, LineSegment2D_F64 l ) {
double a1 = l.b.x - l.a.x;
double b1 = l.b.y - l.a.y;
double top = target.slope.y * ( l.a.x - target.p.x ) + target.slope.x * ( target.p.y - l.a.y );
double bottom = target.slope.x * b1 - target.slope.y * a1;
if( bottom ... | java | {
"resource": ""
} |
q177605 | Intersection2D_F64.intersection | test | public static double intersection( Polygon2D_F64 a , Polygon2D_F64 b ) {
AreaIntersectionPolygon2D_F64 alg = new AreaIntersectionPolygon2D_F64();
return Math.abs(alg.computeArea(a,b));
} | java | {
"resource": ""
} |
q177606 | Intersection2D_F64.contains | test | public static boolean contains(EllipseRotated_F64 ellipse , double x , double y ) {
return (UtilEllipse_F64.evaluate(x,y, ellipse) <= 1.0 );
} | java | {
"resource": ""
} |
q177607 | Intersection2D_F64.intersectionArea | test | public static double intersectionArea( Rectangle2D_F64 a , Rectangle2D_F64 b ) {
if( !intersects(a,b) )
return 0;
double x0 = Math.max(a.p0.x,b.p0.x);
double x1 = Math.min(a.p1.x,b.p1.x);
double y0 = Math.max(a.p0.y,b.p0.y);
double y1 = Math.min(a.p1.y,b.p1.y);
return (x1-x0)*(y1-y0);
} | java | {
"resource": ""
} |
q177608 | ConvertRotation3D_F64.get | test | private static double get( DMatrixRMaj M , int index ) {
if( index < 0 ) {
return -M.data[-index-1];
} else {
return M.data[index-1];
}
} | java | {
"resource": ""
} |
q177609 | ConvertRotation3D_F64.matrixToQuaternion | test | public static Quaternion_F64 matrixToQuaternion( DMatrixRMaj R, Quaternion_F64 quat ) {
if( quat == null )
quat = new Quaternion_F64();
// algorithm from:
// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/
//
// Designed to minimize numerical error by not dividing b... | java | {
"resource": ""
} |
q177610 | ConvertRotation3D_F64.rotX | test | public static DMatrixRMaj rotX( double ang, DMatrixRMaj R ) {
if( R == null )
R = new DMatrixRMaj( 3, 3 );
setRotX( ang, R );
return R;
} | java | {
"resource": ""
} |
q177611 | ConvertRotation3D_F64.setRotX | test | public static void setRotX( double ang, DMatrixRMaj R ) {
double c = Math.cos( ang );
double s = Math.sin( ang );
R.set( 0, 0, 1 );
R.set( 1, 1, c );
R.set( 1, 2, -s );
R.set( 2, 1, s );
R.set( 2, 2, c );
} | java | {
"resource": ""
} |
q177612 | ConvertRotation3D_F64.rotY | test | public static DMatrixRMaj rotY( double ang, DMatrixRMaj R ) {
R = checkDeclare3x3( R );
setRotY( ang, R );
return R;
} | java | {
"resource": ""
} |
q177613 | ConvertRotation3D_F64.rotZ | test | public static DMatrixRMaj rotZ( double ang, DMatrixRMaj R ) {
R = checkDeclare3x3( R );
setRotZ( ang, R );
return R;
} | java | {
"resource": ""
} |
q177614 | ConvertRotation3D_F64.setRotZ | test | public static void setRotZ( double ang, DMatrixRMaj r ) {
double c = Math.cos( ang );
double s = Math.sin( ang );
r.set( 0, 0, c );
r.set( 0, 1, -s );
r.set( 1, 0, s );
r.set( 1, 1, c );
r.set( 2, 2, 1 );
} | java | {
"resource": ""
} |
q177615 | ConvertRotation3D_F64.eulerToMatrix | test | public static DMatrixRMaj eulerToMatrix( EulerType type ,
double rotA, double rotB, double rotC,
DMatrixRMaj R ) {
R = checkDeclare3x3( R );
DMatrixRMaj R_a = rotationAboutAxis( type.getAxisA(), rotA, null );
DMatrixRMaj R_b = rotationAboutAxis( type.getAxisB(), rotB, null );
DMatrixRMa... | java | {
"resource": ""
} |
q177616 | ConvertRotation3D_F64.rotationAboutAxis | test | private static DMatrixRMaj rotationAboutAxis(int axis, double angle, DMatrixRMaj R ) {
switch( axis ) {
case 0:
return ConvertRotation3D_F64.rotX( angle, R );
case 1:
return ConvertRotation3D_F64.rotY( angle, R );
case 2:
return ConvertRotation3D_F64.rotZ( angle, R );
default:
throw new... | java | {
"resource": ""
} |
q177617 | LineParametric2D_F64.setAngle | test | public void setAngle( double angle ) {
slope.set( Math.cos( angle ), Math.sin( angle ) );
} | java | {
"resource": ""
} |
q177618 | TwistOps_F64.twist | test | public static TwistCoordinate_F64 twist( Se3_F64 motion , TwistCoordinate_F64 twist ) {
if( twist == null )
twist = new TwistCoordinate_F64();
if(MatrixFeatures_DDRM.isIdentity(motion.R, GrlConstants.TEST_F64)) {
twist.w.set(0,0,0);
twist.v.set(motion.T);
} else {
Rodrigues_F64 rod = new Rodrigues_F6... | java | {
"resource": ""
} |
q177619 | InterpolateLinearSe3_F64.setTransforms | test | public void setTransforms( Se3_F64 initial , Se3_F64 end) {
this.initial.set(initial);
translation.x = end.T.x - initial.T.x;
translation.y = end.T.y - initial.T.y;
translation.z = end.T.z - initial.T.z;
CommonOps_DDRM.multTransA(initial.getR(), end.getR(), R);
ConvertRotation3D_F64.matrixToRodrigues(R,r... | java | {
"resource": ""
} |
q177620 | InterpolateLinearSe3_F64.interpolate | test | public void interpolate( double where , Se3_F64 output ) {
rotation.setTheta(where*rotMagnitude);
ConvertRotation3D_F64.rodriguesToMatrix(rotation,R);
output.T.x = initial.T.x + where*translation.x;
output.T.y = initial.T.y + where*translation.y;
output.T.z = initial.T.z + where*translation.z;
CommonOps_D... | java | {
"resource": ""
} |
q177621 | FitPlane3D_F64.svd | test | public boolean svd( List<Point3D_F64> points , Point3D_F64 outputCenter , Vector3D_F64 outputNormal ) {
final int N = points.size();
// find the centroid
outputCenter.set(0,0,0);
for( int i = 0; i < N; i++ ) {
Point3D_F64 p = points.get(i);
outputCenter.x += p.x;
outputCenter.y += p.y;
outputCente... | java | {
"resource": ""
} |
q177622 | FitPlane3D_F64.solvePoint | test | public boolean solvePoint(List<Point3D_F64> points , Point3D_F64 pointOnPlane , Vector3D_F64 outputNormal ) {
final int N = points.size();
// construct the matrix
A.reshape(N,3);
int index = 0;
for( int i = 0; i < N; i++ ) {
Point3D_F64 p = points.get(i);
A.data[index++] = p.x - pointOnPlane.x;
A.d... | java | {
"resource": ""
} |
q177623 | Polygon2D_F64.getSideLength | test | public double getSideLength( int index ) {
Point2D_F64 a = vertexes.get( index );
Point2D_F64 b = vertexes.get( (index+1)%vertexes.size );
return (double)a.distance(b);
} | java | {
"resource": ""
} |
q177624 | Polygon2D_F64.isInside | test | public boolean isInside( Point2D_F64 p ) {
if( isConvex() ) {
return Intersection2D_F64.containConvex(this,p);
} else {
return Intersection2D_F64.containConcave(this,p);
}
} | java | {
"resource": ""
} |
q177625 | UtilCurves_F64.convert | test | public static DMatrixRMaj convert(ConicGeneral_F64 src , DMatrixRMaj dst )
{
if( dst == null )
dst = new DMatrixRMaj(3,3);
else
dst.reshape(3,3);
double B = src.B/2.0;
double D = src.D/2.0;
double E = src.E/2.0;
dst.data[0] = src.A; dst.data[1] = B; dst.data[2] = D;
dst.data[3] = B; dst.d... | java | {
"resource": ""
} |
q177626 | UtilCurves_F64.convert | test | public static DMatrix3x3 convert(ConicGeneral_F64 src , DMatrix3x3 dst )
{
if( dst == null )
dst = new DMatrix3x3();
double B = src.B/2.0;
double D = src.D/2.0;
double E = src.E/2.0;
dst.a11 = src.A; dst.a12 = B; dst.a13 = D;
dst.a21 = B; dst.a22 = src.C; dst.a23 = E;
dst.a31 = D; dst.a3... | java | {
"resource": ""
} |
q177627 | UtilCurves_F64.convert | test | public static ParabolaGeneral_F64 convert(ConicGeneral_F64 src , ParabolaGeneral_F64 dst ) {
if( dst == null )
dst = new ParabolaGeneral_F64();
// NOTE haven't put much through if this is the correct way to handle negative values of A or C
dst.A = Math.signum(src.A) * Math.sqrt(Math.abs(src.A));
dst.C = Mat... | java | {
"resource": ""
} |
q177628 | UtilCurves_F64.convert | test | public static ConicGeneral_F64 convert(ParabolaGeneral_F64 src , ConicGeneral_F64 dst ) {
if( dst == null )
dst = new ConicGeneral_F64();
dst.A = src.A*src.A;
dst.B = src.A*src.C*2.0;
dst.C = src.C*src.C;
dst.D = src.D;
dst.E = src.E;
dst.F = src.F;
return dst;
} | java | {
"resource": ""
} |
q177629 | GeometryMath_F64.divide | test | public static void divide( GeoTuple3D_F64 p , double v ) {
p.x /= v;
p.y /= v;
p.z /= v;
} | java | {
"resource": ""
} |
q177630 | GeometryMath_F64.toMatrix | test | public static DMatrixRMaj toMatrix(GeoTuple3D_F64 in, DMatrixRMaj out) {
if( out == null )
out = new DMatrixRMaj(3,1);
else if( out.getNumElements() != 3 )
throw new IllegalArgumentException("Vector with 3 elements expected");
out.data[0] = in.x;
out.data[1] = in.y;
out.data[2] = in.z;
return out;
... | java | {
"resource": ""
} |
q177631 | GeometryMath_F64.toTuple3D | test | public static void toTuple3D(DMatrixRMaj in, GeoTuple3D_F64 out) {
out.x = (double)in.get(0);
out.y = (double)in.get(1);
out.z = (double)in.get(2);
} | java | {
"resource": ""
} |
q177632 | Rodrigues_F64.setParamVector | test | public void setParamVector( double x , double y , double z ) {
double ax = Math.abs(x);
double ay = Math.abs(y);
double az = Math.abs(z);
double max = Math.max(ax,ay);
max = Math.max(max,az);
if( max == 0 ) {
theta = 0;
unitAxisRotation.set(1,0,0);
} else {
x /= max;
y /= max;
z /= max... | java | {
"resource": ""
} |
q177633 | UtilAngle.distHalf | test | public static double distHalf( double angA , double angB ) {
double a = Math.abs(angA-angB);
if( a <= Math.PI/2 )
return a;
else
return Math.PI-a;
} | java | {
"resource": ""
} |
q177634 | Intersection3D_F64.intersect | test | public static boolean intersect( PlaneGeneral3D_F64 a , PlaneGeneral3D_F64 b , LineParametric3D_F64 line ) {
// Line's slope is the cross product of the two normal vectors
GeometryMath_F64.cross(a.A,a.B,a.C,b.A,b.B,b.C,line.slope);
if( line.slope.normSq() == 0 )
return false;
// Closest point on plane 'a'... | java | {
"resource": ""
} |
q177635 | Intersection3D_F64.containedPlane | test | private static boolean containedPlane( Point3D_F64 T_v0,
Point3D_F64 output,
Vector3D_F64 u , Vector3D_F64 v ,
Vector3D_F64 w0 ) {
double uu, uv, vv, wu, wv, D;
uu = u.dot(u);
uv = u.dot(v);
vv = v.dot(v);
w0.minus(output,T_v0);
wu = w0.dot(u);
wv = w0.dot(v);
D = ... | java | {
"resource": ""
} |
q177636 | Intersection3D_F64.intersect | test | public static boolean intersect(LineParametric3D_F64 line , Sphere3D_F64 sphere ,
Point3D_F64 a, Point3D_F64 b ) {
// this equation was found by solving for l:
// ||(P + V*l) - X0|| == r
double r2 = sphere.radius*sphere.radius;
double PP = GeometryMath_F64.dot(line.p,line.p);
double PV = GeometryM... | java | {
"resource": ""
} |
q177637 | InterpolateLinearSe2_F64.interpolate | test | public static void interpolate(Se2_F64 a , Se2_F64 b , double where, Se2_F64 output) {
double w0 = 1.0-where;
output.T.x = a.T.x*w0 + b.T.x*where;
output.T.y = a.T.y*w0 + b.T.y*where;
// interpolating rotation is more difficult
// This only works well if the difference between the two angles is small
dou... | java | {
"resource": ""
} |
q177638 | MotionSe3PointCrossCovariance_F64.extractQuaternionFromQ | test | private void extractQuaternionFromQ( SimpleMatrix q ) {
SimpleEVD<SimpleMatrix> evd = q.eig();
int indexMax = evd.getIndexMax();
SimpleMatrix v_max = evd.getEigenVector( indexMax );
quat.w = (double) v_max.get( 0 );
quat.x = (double) v_max.get( 1 );
quat.y = (double) v_max.get( 2 );
quat.z = (double) v_... | java | {
"resource": ""
} |
q177639 | AndrewMonotoneConvexHull_F64.process | test | public void process( Point2D_F64[] input , int length , Polygon2D_F64 hull )
{
// ahdnle special cases
if( length == 2 ) {
hull.vertexes.resize(length);
for (int i = 0; i < length; i++) {
hull.get(i).set(input[i]);
}
return;
}
sorter.sort(input,length);
work.reset();
// construct the lowe... | java | {
"resource": ""
} |
q177640 | SpecialEuclideanOps_F64.setToNoMotion | test | public static void setToNoMotion( Se3_F64 se ) {
CommonOps_DDRM.setIdentity( se.getR() );
se.getT().set( 0, 0, 0 );
} | java | {
"resource": ""
} |
q177641 | SpecialEuclideanOps_F64.toHomogeneous | test | public static DMatrixRMaj toHomogeneous( Se3_F64 se, DMatrixRMaj ret ) {
if( ret == null )
ret = new DMatrixRMaj( 4, 4 );
else {
ret.set( 3, 0, 0 );
ret.set( 3, 1, 0 );
ret.set( 3, 2, 0 );
}
CommonOps_DDRM.insert( se.getR(), ret, 0, 0 );
Vector3D_F64 T = se.getT();
ret.set( 0, 3, T.x );
ret.... | java | {
"resource": ""
} |
q177642 | SpecialEuclideanOps_F64.toHomogeneous | test | public static DMatrixRMaj toHomogeneous( Se2_F64 se, DMatrixRMaj ret ) {
if( ret == null )
ret = new DMatrixRMaj( 3, 3 );
else {
ret.set( 2, 0, 0 );
ret.set( 2, 1, 0 );
}
final double c = se.getCosineYaw();
final double s = se.getSineYaw();
ret.set( 0, 0, c );
ret.set( 0, 1, -s );
ret.set( 1,... | java | {
"resource": ""
} |
q177643 | SpecialEuclideanOps_F64.axisXyz | test | public static Se3_F64 axisXyz(double dx, double dy, double dz, double rotX, double rotY, double rotZ,
Se3_F64 se) {
if( se == null )
se = new Se3_F64();
double theta = Math.sqrt(rotX*rotX + rotY+rotY + rotZ*rotZ);
if( theta == 0 ) {
CommonOps_DDRM.setIdentity(se.R);
} else {
ConvertRotation3... | java | {
"resource": ""
} |
q177644 | SpecialEuclideanOps_F64.isIdentical | test | public static boolean isIdentical( Se3_F64 a , Se3_F64 b , double tolT , double tolR ) {
if( Math.abs(a.T.x-b.T.x) > tolT )
return false;
if( Math.abs(a.T.y-b.T.y) > tolT )
return false;
if( Math.abs(a.T.z-b.T.z) > tolT )
return false;
DMatrixRMaj D = new DMatrixRMaj(3,3);
CommonOps_DDRM.multTransA(... | java | {
"resource": ""
} |
q177645 | ConvertCoordinates3D_F64.latlonToUnitVector | test | public static <T extends GeoTuple3D_F64<T>> T latlonToUnitVector(double lat , double lon , T vector ) {
if( vector == null )
vector = (T)new Vector3D_F64();
vector.x = Math.cos(lat) * Math.cos(lon);
vector.y = Math.cos(lat) * Math.sin(lon);
vector.z = -Math.sin(lat);
return vector;
} | java | {
"resource": ""
} |
q177646 | UtilCircle2D_F64.circle | test | public static boolean circle(Point2D_F64 x0 , Point2D_F64 x1 , Point2D_F64 x2 , Circle2D_F64 circle ) {
// points that lie on line a and b
double xa = (x0.x+x1.x)/2.0;
double ya = (x0.y+x1.y)/2.0;
double xb = (x1.x+x2.x)/2.0;
double yb = (x1.y+x2.y)/2.0;
// slopes of lines a and b
double m2 = x0.x-x1.x;... | java | {
"resource": ""
} |
q177647 | UtilCircle2D_F64.circleRadiusSq | test | public static double circleRadiusSq(Point2D_F64 x0 , Point2D_F64 x1 , Point2D_F64 x2) {
// points that lie on line a and b
double xa = (x0.x+x1.x)/2.0;
double ya = (x0.y+x1.y)/2.0;
double xb = (x1.x+x2.x)/2.0;
double yb = (x1.y+x2.y)/2.0;
// slopes of lines a and b
double m2 = x0.x-x1.x;
double m1 = x1... | java | {
"resource": ""
} |
q177648 | ClosestPoint3D_F64.closestPoint | test | public static Point3D_F64 closestPoint(LineParametric3D_F64 l0,
LineParametric3D_F64 l1,
Point3D_F64 ret) {
if( ret == null ) {
ret = new Point3D_F64();
}
ret.x = l0.p.x - l1.p.x;
ret.y = l0.p.y - l1.p.y;
ret.z = l0.p.z - l1.p.z;
// this solution is from: http://local.wasp.uwa... | java | {
"resource": ""
} |
q177649 | ClosestPoint3D_F64.closestPoint | test | public static Point3D_F64 closestPoint(LineParametric3D_F64 line, Point3D_F64 pt, Point3D_F64 ret)
{
if( ret == null ) {
ret = new Point3D_F64();
}
double dx = pt.x - line.p.x;
double dy = pt.y - line.p.y;
double dz = pt.z - line.p.z;
double n2 = line.slope.normSq();
double d = (line.slope.x*dx + l... | java | {
"resource": ""
} |
q177650 | ClosestPoint3D_F64.closestPointOrigin | test | public static Point3D_F64 closestPointOrigin( PlaneGeneral3D_F64 plane , Point3D_F64 found ) {
if( found == null )
found = new Point3D_F64();
double n2 = plane.A*plane.A + plane.B*plane.B + plane.C*plane.C;
found.x = plane.A*plane.D/n2;
found.y = plane.B*plane.D/n2;
found.z = plane.C*plane.D/n2;
retur... | java | {
"resource": ""
} |
q177651 | ClosestPoint3D_F64.closestPoint | test | public static Point3D_F64 closestPoint(LineSegment3D_F64 line, Point3D_F64 pt, Point3D_F64 ret) {
if( ret == null ) {
ret = new Point3D_F64();
}
double dx = pt.x - line.a.x;
double dy = pt.y - line.a.y;
double dz = pt.z - line.a.z;
double slope_x = line.b.x - line.a.x;
double slope_y = line.b.y - lin... | java | {
"resource": ""
} |
q177652 | ClosestPoint3D_F64.closestPoint | test | public static Point3D_F64 closestPoint( Point3D_F64 vertexA, Point3D_F64 vertexB, Point3D_F64 vertexC,
Point3D_F64 point , Point3D_F64 ret) {
if( ret == null ) {
ret = new Point3D_F64();
}
DistancePointTriangle3D_F64 alg = new DistancePointTriangle3D_F64();
alg.setTriangle(vertexA,vertexB,vertex... | java | {
"resource": ""
} |
q177653 | SePointOps_F64.transform | test | public static Point2D_F64 transform( Se2_F64 se, Point2D_F64 orig, Point2D_F64 result ) {
if( result == null ) {
result = new Point2D_F64();
}
final double c = se.getCosineYaw();
final double s = se.getSineYaw();
// copy the values so that no errors happen if orig and result are the same instance
doub... | java | {
"resource": ""
} |
q177654 | SePointOps_F64.transform | test | public static void transform( Se2_F64 se, Point2D_F64 points[], int length ) {
double tranX = se.getX();
double tranY = se.getY();
final double c = se.getCosineYaw();
final double s = se.getSineYaw();
for( int i = 0; i < length; i++ ) {
Point2D_F64 pt = points[i];
double x = pt.x;
double y = pt.y... | java | {
"resource": ""
} |
q177655 | Quadrilateral_F64.isEquals | test | public boolean isEquals( Quadrilateral_F64 quad , double tol ) {
tol *= tol;
if( a.distance2(quad.a) > tol )
return false;
if( b.distance2(quad.b) > tol )
return false;
if( c.distance2(quad.c) > tol )
return false;
return d.distance2(quad.d) <= tol;
} | java | {
"resource": ""
} |
q177656 | UtilLine2D_F64.acuteAngle | test | public static double acuteAngle( LineGeneral2D_F64 a , LineGeneral2D_F64 b ) {
double la = Math.sqrt(a.A*a.A + a.B*a.B);
double lb = Math.sqrt(b.A*b.A + b.B*b.B);
// numerical round off error can cause it to be barely greater than 1, which is outside the allowed
// domain of acos()
double value = (a.A*b.A + ... | java | {
"resource": ""
} |
q177657 | UtilLine2D_F64.convert | test | public static LineParametric2D_F64 convert( LinePolar2D_F64 src , LineParametric2D_F64 ret )
{
if( ret == null )
ret = new LineParametric2D_F64();
double c = (double) Math.cos(src.angle);
double s = (double) Math.sin(src.angle);
ret.p.set(c*src.distance,s*src.distance);
ret.slope.set(-s,c);
return re... | java | {
"resource": ""
} |
q177658 | UtilLine2D_F64.convert | test | public static LinePolar2D_F64 convert( LineGeneral2D_F64 src , LinePolar2D_F64 ret )
{
if( ret == null )
ret = new LinePolar2D_F64();
double r = Math.sqrt(src.A*src.A + src.B*src.B);
double sign = src.C < 0 ? -1 : 1;
ret.angle = Math.atan2(-sign*src.B/r,-sign*src.A/r);
ret.distance = sign*src.C/r;
r... | java | {
"resource": ""
} |
q177659 | UtilLine2D_F64.convert | test | public static LineParametric2D_F64 convert( LineSegment2D_F64 src , LineParametric2D_F64 ret )
{
if( ret == null )
ret = new LineParametric2D_F64();
ret.p.set(src.a);
ret.slope.set(src.slopeX(),src.slopeY());
return ret;
} | java | {
"resource": ""
} |
q177660 | UtilLine2D_F64.convert | test | public static LineGeneral2D_F64 convert( LineSegment2D_F64 src , LineGeneral2D_F64 ret )
{
return convert(src.a,src.b,ret);
} | java | {
"resource": ""
} |
q177661 | UtilLine2D_F64.convert | test | public static LineGeneral2D_F64 convert( Point2D_F64 a , Point2D_F64 b , LineGeneral2D_F64 ret )
{
if( ret == null )
ret = new LineGeneral2D_F64();
ret.A = a.y - b.y;
ret.B = b.x - a.x;
ret.C = -(ret.A*a.x + ret.B*a.y);
return ret;
} | java | {
"resource": ""
} |
q177662 | UtilLine2D_F64.convert | test | public static LineParametric2D_F64 convert( Point2D_F64 a , Point2D_F64 b , LineParametric2D_F64 ret )
{
if( ret == null )
ret = new LineParametric2D_F64();
ret.p.set(a);
ret.slope.x = b.x-a.x;
ret.slope.y = b.y-a.y;
return ret;
} | java | {
"resource": ""
} |
q177663 | UtilLine2D_F64.convert | test | public static LinePolar2D_F64 convert( LineParametric2D_F64 src , LinePolar2D_F64 ret )
{
if( ret == null )
ret = new LinePolar2D_F64();
double top = src.slope.y*src.p.x - src.slope.x*src.p.y;
ret.distance = top/src.slope.norm();
ret.angle = Math.atan2(-src.slope.x,src.slope.y);
if( ret.distance < 0 ) {... | java | {
"resource": ""
} |
q177664 | UtilLine2D_F64.convert | test | public static LineGeneral2D_F64 convert( LineParametric2D_F64 src , LineGeneral2D_F64 ret ) {
if( ret == null ) {
ret = new LineGeneral2D_F64();
}
ret.A = -src.slope.y;
ret.B = src.slope.x;
ret.C = -ret.A*src.p.x - ret.B*src.p.y;
return ret;
} | java | {
"resource": ""
} |
q177665 | UtilLine2D_F64.convert | test | public static LineParametric2D_F64 convert( LineGeneral2D_F64 src , LineParametric2D_F64 ret ) {
if( ret == null ) {
ret = new LineParametric2D_F64();
}
ret.slope.x = src.B;
ret.slope.y = -src.A;
// find a point on the line
if( Math.abs(src.B) > Math.abs(src.A) ) {
ret.p.y = -src.C/src.B;
ret.p.... | java | {
"resource": ""
} |
q177666 | UtilPlane3D_F64.convert | test | public static PlaneGeneral3D_F64 convert( PlaneNormal3D_F64 input , PlaneGeneral3D_F64 output ) {
if( output == null )
output = new PlaneGeneral3D_F64();
Vector3D_F64 n = input.n;
Point3D_F64 p = input.p;
output.A = n.x;
output.B = n.y;
output.C = n.z;
output.D = n.x*p.x + n.y*p.y + n.z*p.z;
retur... | java | {
"resource": ""
} |
q177667 | UtilPlane3D_F64.convert | test | public static PlaneNormal3D_F64 convert( PlaneTangent3D_F64 input , PlaneNormal3D_F64 output ) {
if( output == null )
output = new PlaneNormal3D_F64();
// the value of input is a vector normal to the plane and a point on the plane.
output.n.x = input.x;
output.n.y = input.y;
output.n.z = input.z;
outpu... | java | {
"resource": ""
} |
q177668 | UtilPlane3D_F64.convert | test | public static PlaneNormal3D_F64 convert( Se3_F64 planeToWorld , PlaneNormal3D_F64 output ) {
if( output == null )
output = new PlaneNormal3D_F64();
// the value of input is a vector normal to the plane and a point on the plane.
output.n.x = planeToWorld.R.unsafe_get(0,2);
output.n.y = planeToWorld.R.unsafe_... | java | {
"resource": ""
} |
q177669 | UtilPlane3D_F64.point2Dto3D | test | public static void point2Dto3D(Point3D_F64 origin ,
Vector3D_F64 axisX , Vector3D_F64 axisY,
Point2D_F64 A , Point3D_F64 output ) {
output.x = origin.x + axisX.x*A.x + axisY.y*A.y;
output.y = origin.y + axisX.y*A.x + axisY.y*A.y;
output.z = origin.z + axisX.z*A.x + axisY.y*A.y;
} | java | {
"resource": ""
} |
q177670 | UtilPlane3D_F64.planeToWorld | test | public static Se3_F64 planeToWorld( PlaneGeneral3D_F64 plane , Se3_F64 planeToWorld ) {
if( planeToWorld == null )
planeToWorld = new Se3_F64();
Vector3D_F64 axisZ = new Vector3D_F64(plane.A,plane.B,plane.C);
axisZ.normalize();
Vector3D_F64 axisX = new Vector3D_F64();
Vector3D_F64 axisY = new Vector3D_F6... | java | {
"resource": ""
} |
q177671 | GeoTuple_F64.isIdentical | test | public boolean isIdentical( T t, double tol ) {
if( t.getDimension() != getDimension() )
return false;
int N = getDimension();
for( int i = 0; i < N; i++ ) {
double diff = Math.abs( getIdx( i ) - t.getIdx( i ) );
if( diff > tol )
return false;
}
return true;
} | java | {
"resource": ""
} |
q177672 | GeoTuple_F64.copy | test | @Override
public T copy() {
T ret = createNewInstance();
int N = getDimension();
for( int i = 0; i < N; i++ ) {
ret.setIdx( i, getIdx( i ) );
}
return ret;
} | java | {
"resource": ""
} |
q177673 | GeoTuple_F64.normSq | test | public double normSq() {
double total = 0;
int N = getDimension();
for( int i = 0; i < N; i++ ) {
double a = getIdx( i );
total += a * a;
}
return total;
} | java | {
"resource": ""
} |
q177674 | UtilLine3D_F64.computeT | test | public static double computeT( LineParametric3D_F64 line , Point3D_F64 pointOnLine ) {
double dx = pointOnLine.x - line.p.x;
double dy = pointOnLine.y - line.p.y;
double dz = pointOnLine.z - line.p.z;
double adx = Math.abs(dx);
double ady = Math.abs(dy);
double adz = Math.abs(dz);
double t;
if( adx ... | java | {
"resource": ""
} |
q177675 | ParabolaGeneral_F64.hasUncountable | test | public boolean hasUncountable() {
return UtilEjml.isUncountable(A) || UtilEjml.isUncountable(C)
|| UtilEjml.isUncountable(D) || UtilEjml.isUncountable(E) ||
UtilEjml.isUncountable(F);
} | java | {
"resource": ""
} |
q177676 | ParabolaGeneral_F64.isEquivalent | test | public boolean isEquivalent( ParabolaGeneral_F64 parabola , double tol ) {
double scale = relativeScale(parabola);
if( Math.abs(A*scale-parabola.A) > tol )
return false;
if( Math.abs(C*scale-parabola.C) > tol )
return false;
if( Math.abs(D*scale-parabola.D) > tol )
return false;
if( Math.abs(E*scale... | java | {
"resource": ""
} |
q177677 | Box3D_F64.center | test | public Point3D_F64 center( Point3D_F64 storage ) {
if( storage == null )
storage = new Point3D_F64();
storage.x = (p0.x + p1.x)/2.0;
storage.y = (p0.y + p1.y)/2.0;
storage.z = (p0.z + p1.z)/2.0;
return storage;
} | java | {
"resource": ""
} |
q177678 | UtilLine2D_I32.acuteAngle | test | public static double acuteAngle( LineSegment2D_I32 line0 , LineSegment2D_I32 line1 ) {
int dx0 = line0.b.x - line0.a.x;
int dy0 = line0.b.y - line0.a.y;
int dx1 = line1.b.x - line1.a.x;
int dy1 = line1.b.y - line1.a.y;
double bottom = Math.sqrt(dx0*dx0 + dy0*dy0) * Math.sqrt(dx1*dx1 + dy1*dy1);
return Math... | java | {
"resource": ""
} |
q177679 | UtilPoint4D_F64.isInfiniteH | test | public static boolean isInfiniteH(Point4D_F64 p , double tol ) {
double n = Math.sqrt(p.x*p.x + p.y*p.y + p.z*p.z);
return Math.abs(p.w) <= n*tol;
} | java | {
"resource": ""
} |
q177680 | UtilPoint4D_F64.randomN | test | public static List<Point4D_F64> randomN( Point3D_F64 center , double w, double stdev, int num, Random rand ) {
List<Point4D_F64> ret = new ArrayList<>();
for( int i = 0; i < num; i++ ) {
Point4D_F64 p = new Point4D_F64();
p.x = center.x + rand.nextGaussian() * stdev;
p.y = center.y + rand.nextGaussian() *... | java | {
"resource": ""
} |
q177681 | UtilPoint4D_F64.h_to_e | test | public static Point3D_F64 h_to_e( Point4D_F64 p ) {
Point3D_F64 out = new Point3D_F64();
h_to_e(p,out);
return out;
} | java | {
"resource": ""
} |
q177682 | UtilVector2D_F64.minus | test | public static Vector2D_F64 minus( Point2D_F64 a , Point2D_F64 b , Vector2D_F64 output ) {
if( output == null )
output = new Vector2D_F64();
output.x = a.x - b.x;
output.y = a.y - b.y;
return output;
} | java | {
"resource": ""
} |
q177683 | UtilVector2D_F64.identicalSign | test | public static boolean identicalSign( double xa , double ya , double xb , double yb , double tol ) {
double dx0 = xb-xa;
double dy0 = yb-ya;
double dx1 = xb+xa;
double dy1 = yb+ya;
double error0 = dx0*dx0 + dy0*dy0;
double error1 = dx1*dx1 + dy1*dy1;
if( error0 < error1 ) {
return error0 <= tol*tol;
... | java | {
"resource": ""
} |
q177684 | RectangleLength2D_F64.set | test | public void set(RectangleLength2D_I32 r) {
this.x0 = r.x0;
this.y0 = r.y0;
this.width = r.width;
this.height = r.height;
} | java | {
"resource": ""
} |
q177685 | UtilEllipse_F64.convert | test | public static EllipseQuadratic_F64 convert( EllipseRotated_F64 input , EllipseQuadratic_F64 output ) {
if( output == null )
output = new EllipseQuadratic_F64();
double x0 = input.center.x;
double y0 = input.center.y;
double a = input.a;
double b = input.b;
double phi = input.phi;
double cphi = Math.c... | java | {
"resource": ""
} |
q177686 | UtilEllipse_F64.computePoint | test | public static Point2D_F64 computePoint( double t , EllipseRotated_F64 ellipse , Point2D_F64 output ) {
if( output == null )
output = new Point2D_F64();
double ct = Math.cos(t);
double st = Math.sin(t);
double cphi = Math.cos(ellipse.phi);
double sphi = Math.sin(ellipse.phi);
// coordinate in ellipse fr... | java | {
"resource": ""
} |
q177687 | UtilEllipse_F64.computeAngle | test | public static double computeAngle( Point2D_F64 p , EllipseRotated_F64 ellipse ) {
// put point into ellipse's reference frame
double ce = Math.cos(ellipse.phi);
double se = Math.sin(ellipse.phi);
// world into ellipse frame
double xc = p.x - ellipse.center.x;
double yc = p.y - ellipse.center.y;
double x... | java | {
"resource": ""
} |
q177688 | UtilEllipse_F64.computeTangent | test | public static Vector2D_F64 computeTangent( double t ,
EllipseRotated_F64 ellipse ,
Vector2D_F64 output ) {
if( output == null )
output = new Vector2D_F64();
double ct = Math.cos(t);
double st = Math.sin(t);
double cphi = Math.cos(ellipse.phi);
double sphi = Math.sin(ellipse.ph... | java | {
"resource": ""
} |
q177689 | TangentLinesTwoEllipses_F64.selectTangent | test | boolean selectTangent( Point2D_F64 a , Point2D_F64 previousTangent ,
EllipseRotated_F64 ellipse, Point2D_F64 tangent ,
boolean cross )
{
if( !tangentLines(a,ellipse,temp0,temp1) )
return false;
tempLine.a = a;
tempLine.b = temp0;
boolean crossed0 = Intersection2D_F64.intersection(centerL... | java | {
"resource": ""
} |
q177690 | BoxLength3D_F64.getCorner | test | public Point3D_F64 getCorner(int index , Point3D_F64 corner ) {
if( corner == null )
corner = new Point3D_F64();
corner.set(p);
if( (index & 0x01) != 0 ) {
corner.x += lengthX;
}
if( (index & 0x02) != 0 ) {
corner.y += lengthY;
}
if( (index & 0x04) != 0 ) {
corner.z += lengthZ;
}
return ... | java | {
"resource": ""
} |
q177691 | Distance3D_F64.distance | test | public static double distance( LineParametric3D_F64 l0,
LineParametric3D_F64 l1 ) {
double x = l0.p.x - l1.p.x;
double y = l0.p.y - l1.p.y;
double z = l0.p.z - l1.p.z;
// this solution is from: http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline3d/
double dv01v1 = MiscOps.dot( x,y,z, l1.slope ... | java | {
"resource": ""
} |
q177692 | Distance3D_F64.distance | test | public static double distance( LineParametric3D_F64 l,
Point3D_F64 p ) {
double x = l.p.x - p.x;
double y = l.p.y - p.y;
double z = l.p.z - p.z;
double cc = x*x + y*y + z*z;
// could avoid a square root here by computing b*b directly
// however that is most likely more prone to numerical overf... | java | {
"resource": ""
} |
q177693 | Distance3D_F64.distance | test | public static double distance( LineSegment3D_F64 l,
Point3D_F64 p ) {
double dx = p.x - l.a.x;
double dy = p.y - l.a.y;
double dz = p.z - l.a.z;
double cc = dx*dx + dy*dy + dz*dz;
double slope_x = l.b.x - l.a.x;
double slope_y = l.b.y - l.a.y;
double slope_z = l.b.z - l.a.z;
double n = (d... | java | {
"resource": ""
} |
q177694 | Distance3D_F64.distance | test | public static double distance( PlaneGeneral3D_F64 plane , Point3D_F64 point ) {
double top = plane.A*point.x + plane.B*point.y + plane.C*point.z - plane.D;
return top / Math.sqrt( plane.A*plane.A + plane.B*plane.B + plane.C*plane.C);
} | java | {
"resource": ""
} |
q177695 | Distance3D_F64.distance | test | public static double distance( Cylinder3D_F64 cylinder, Point3D_F64 point ) {
double r = Distance3D_F64.distance(cylinder.line,point);
return r - cylinder.radius;
} | java | {
"resource": ""
} |
q177696 | Distance2D_F64.distance | test | public static double distance( LineSegment2D_F64 segmentA , LineSegment2D_F64 segmentB ) {
return Math.sqrt(distanceSq(segmentA, segmentB));
} | java | {
"resource": ""
} |
q177697 | Distance2D_F64.distanceSq | test | public static double distanceSq( LineSegment2D_F64 segmentA , LineSegment2D_F64 segmentB ) {
// intersection of the two lines relative to A
double slopeAX = segmentA.slopeX();
double slopeAY = segmentA.slopeY();
double slopeBX = segmentB.slopeX();
double slopeBY = segmentB.slopeY();
double ta = slopeBX*( ... | java | {
"resource": ""
} |
q177698 | Distance2D_F64.distance | test | public static double distance( Quadrilateral_F64 quad , Point2D_F64 p ) {
return Math.sqrt(distanceSq(quad,p));
} | java | {
"resource": ""
} |
q177699 | Distance2D_F64.distanceSq | test | public static double distanceSq( Quadrilateral_F64 quad , Point2D_F64 p ) {
LineSegment2D_F64 seg = LineSegment2D_F64.wrap(quad.a, quad.b);
double a = distanceSq(seg, p);
seg.a = quad.b;seg.b = quad.c;
a = Math.min(a,distanceSq(seg,p));
seg.a = quad.c;seg.b = quad.d;
a = Math.min(a,distanceSq(seg,p));
seg... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.