Subdiv2D.java 10.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405

//
// This file is auto-generated. Please don't modify it!
//
package org.opencv.imgproc;

import java.util.ArrayList;
import java.util.List;
import org.opencv.core.Mat;
import org.opencv.core.MatOfFloat4;
import org.opencv.core.MatOfFloat6;
import org.opencv.core.MatOfInt;
import org.opencv.core.MatOfPoint2f;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.utils.Converters;

// C++: class Subdiv2D
//javadoc: Subdiv2D

public class Subdiv2D {

    protected final long nativeObj;
    protected Subdiv2D(long addr) { nativeObj = addr; }

    public long getNativeObjAddr() { return nativeObj; }

    public static final int
            PTLOC_ERROR = -2,
            PTLOC_OUTSIDE_RECT = -1,
            PTLOC_INSIDE = 0,
            PTLOC_VERTEX = 1,
            PTLOC_ON_EDGE = 2,
            NEXT_AROUND_ORG = 0x00,
            NEXT_AROUND_DST = 0x22,
            PREV_AROUND_ORG = 0x11,
            PREV_AROUND_DST = 0x33,
            NEXT_AROUND_LEFT = 0x13,
            NEXT_AROUND_RIGHT = 0x31,
            PREV_AROUND_LEFT = 0x20,
            PREV_AROUND_RIGHT = 0x02;


    //
    // C++:   Subdiv2D(Rect rect)
    //

    //javadoc: Subdiv2D::Subdiv2D(rect)
    public   Subdiv2D(Rect rect)
    {
        
        nativeObj = Subdiv2D_0(rect.x, rect.y, rect.width, rect.height);
        
        return;
    }


    //
    // C++:   Subdiv2D()
    //

    //javadoc: Subdiv2D::Subdiv2D()
    public   Subdiv2D()
    {
        
        nativeObj = Subdiv2D_1();
        
        return;
    }


    //
    // C++:  Point2f getVertex(int vertex, int* firstEdge = 0)
    //

    //javadoc: Subdiv2D::getVertex(vertex, firstEdge)
    public  Point getVertex(int vertex, int[] firstEdge)
    {
        double[] firstEdge_out = new double[1];
        Point retVal = new Point(getVertex_0(nativeObj, vertex, firstEdge_out));
        if(firstEdge!=null) firstEdge[0] = (int)firstEdge_out[0];
        return retVal;
    }

    //javadoc: Subdiv2D::getVertex(vertex)
    public  Point getVertex(int vertex)
    {
        
        Point retVal = new Point(getVertex_1(nativeObj, vertex));
        
        return retVal;
    }


    //
    // C++:  int edgeDst(int edge, Point2f* dstpt = 0)
    //

    //javadoc: Subdiv2D::edgeDst(edge, dstpt)
    public  int edgeDst(int edge, Point dstpt)
    {
        double[] dstpt_out = new double[2];
        int retVal = edgeDst_0(nativeObj, edge, dstpt_out);
        if(dstpt!=null){ dstpt.x = dstpt_out[0]; dstpt.y = dstpt_out[1]; } 
        return retVal;
    }

    //javadoc: Subdiv2D::edgeDst(edge)
    public  int edgeDst(int edge)
    {
        
        int retVal = edgeDst_1(nativeObj, edge);
        
        return retVal;
    }


    //
    // C++:  int edgeOrg(int edge, Point2f* orgpt = 0)
    //

    //javadoc: Subdiv2D::edgeOrg(edge, orgpt)
    public  int edgeOrg(int edge, Point orgpt)
    {
        double[] orgpt_out = new double[2];
        int retVal = edgeOrg_0(nativeObj, edge, orgpt_out);
        if(orgpt!=null){ orgpt.x = orgpt_out[0]; orgpt.y = orgpt_out[1]; } 
        return retVal;
    }

    //javadoc: Subdiv2D::edgeOrg(edge)
    public  int edgeOrg(int edge)
    {
        
        int retVal = edgeOrg_1(nativeObj, edge);
        
        return retVal;
    }


    //
    // C++:  int findNearest(Point2f pt, Point2f* nearestPt = 0)
    //

    //javadoc: Subdiv2D::findNearest(pt, nearestPt)
    public  int findNearest(Point pt, Point nearestPt)
    {
        double[] nearestPt_out = new double[2];
        int retVal = findNearest_0(nativeObj, pt.x, pt.y, nearestPt_out);
        if(nearestPt!=null){ nearestPt.x = nearestPt_out[0]; nearestPt.y = nearestPt_out[1]; } 
        return retVal;
    }

    //javadoc: Subdiv2D::findNearest(pt)
    public  int findNearest(Point pt)
    {
        
        int retVal = findNearest_1(nativeObj, pt.x, pt.y);
        
        return retVal;
    }


    //
    // C++:  int getEdge(int edge, int nextEdgeType)
    //

    //javadoc: Subdiv2D::getEdge(edge, nextEdgeType)
    public  int getEdge(int edge, int nextEdgeType)
    {
        
        int retVal = getEdge_0(nativeObj, edge, nextEdgeType);
        
        return retVal;
    }


    //
    // C++:  int insert(Point2f pt)
    //

    //javadoc: Subdiv2D::insert(pt)
    public  int insert(Point pt)
    {
        
        int retVal = insert_0(nativeObj, pt.x, pt.y);
        
        return retVal;
    }


    //
    // C++:  int locate(Point2f pt, int& edge, int& vertex)
    //

    //javadoc: Subdiv2D::locate(pt, edge, vertex)
    public  int locate(Point pt, int[] edge, int[] vertex)
    {
        double[] edge_out = new double[1];
        double[] vertex_out = new double[1];
        int retVal = locate_0(nativeObj, pt.x, pt.y, edge_out, vertex_out);
        if(edge!=null) edge[0] = (int)edge_out[0];
        if(vertex!=null) vertex[0] = (int)vertex_out[0];
        return retVal;
    }


    //
    // C++:  int nextEdge(int edge)
    //

    //javadoc: Subdiv2D::nextEdge(edge)
    public  int nextEdge(int edge)
    {
        
        int retVal = nextEdge_0(nativeObj, edge);
        
        return retVal;
    }


    //
    // C++:  int rotateEdge(int edge, int rotate)
    //

    //javadoc: Subdiv2D::rotateEdge(edge, rotate)
    public  int rotateEdge(int edge, int rotate)
    {
        
        int retVal = rotateEdge_0(nativeObj, edge, rotate);
        
        return retVal;
    }


    //
    // C++:  int symEdge(int edge)
    //

    //javadoc: Subdiv2D::symEdge(edge)
    public  int symEdge(int edge)
    {
        
        int retVal = symEdge_0(nativeObj, edge);
        
        return retVal;
    }


    //
    // C++:  void getEdgeList(vector_Vec4f& edgeList)
    //

    //javadoc: Subdiv2D::getEdgeList(edgeList)
    public  void getEdgeList(MatOfFloat4 edgeList)
    {
        Mat edgeList_mat = edgeList;
        getEdgeList_0(nativeObj, edgeList_mat.nativeObj);
        
        return;
    }


    //
    // C++:  void getLeadingEdgeList(vector_int& leadingEdgeList)
    //

    //javadoc: Subdiv2D::getLeadingEdgeList(leadingEdgeList)
    public  void getLeadingEdgeList(MatOfInt leadingEdgeList)
    {
        Mat leadingEdgeList_mat = leadingEdgeList;
        getLeadingEdgeList_0(nativeObj, leadingEdgeList_mat.nativeObj);
        
        return;
    }


    //
    // C++:  void getTriangleList(vector_Vec6f& triangleList)
    //

    //javadoc: Subdiv2D::getTriangleList(triangleList)
    public  void getTriangleList(MatOfFloat6 triangleList)
    {
        Mat triangleList_mat = triangleList;
        getTriangleList_0(nativeObj, triangleList_mat.nativeObj);
        
        return;
    }


    //
    // C++:  void getVoronoiFacetList(vector_int idx, vector_vector_Point2f& facetList, vector_Point2f& facetCenters)
    //

    //javadoc: Subdiv2D::getVoronoiFacetList(idx, facetList, facetCenters)
    public  void getVoronoiFacetList(MatOfInt idx, List<MatOfPoint2f> facetList, MatOfPoint2f facetCenters)
    {
        Mat idx_mat = idx;
        Mat facetList_mat = new Mat();
        Mat facetCenters_mat = facetCenters;
        getVoronoiFacetList_0(nativeObj, idx_mat.nativeObj, facetList_mat.nativeObj, facetCenters_mat.nativeObj);
        Converters.Mat_to_vector_vector_Point2f(facetList_mat, facetList);
        facetList_mat.release();
        return;
    }


    //
    // C++:  void initDelaunay(Rect rect)
    //

    //javadoc: Subdiv2D::initDelaunay(rect)
    public  void initDelaunay(Rect rect)
    {
        
        initDelaunay_0(nativeObj, rect.x, rect.y, rect.width, rect.height);
        
        return;
    }


    //
    // C++:  void insert(vector_Point2f ptvec)
    //

    //javadoc: Subdiv2D::insert(ptvec)
    public  void insert(MatOfPoint2f ptvec)
    {
        Mat ptvec_mat = ptvec;
        insert_1(nativeObj, ptvec_mat.nativeObj);
        
        return;
    }


    @Override
    protected void finalize() throws Throwable {
        delete(nativeObj);
    }



    // C++:   Subdiv2D(Rect rect)
    private static native long Subdiv2D_0(int rect_x, int rect_y, int rect_width, int rect_height);

    // C++:   Subdiv2D()
    private static native long Subdiv2D_1();

    // C++:  Point2f getVertex(int vertex, int* firstEdge = 0)
    private static native double[] getVertex_0(long nativeObj, int vertex, double[] firstEdge_out);
    private static native double[] getVertex_1(long nativeObj, int vertex);

    // C++:  int edgeDst(int edge, Point2f* dstpt = 0)
    private static native int edgeDst_0(long nativeObj, int edge, double[] dstpt_out);
    private static native int edgeDst_1(long nativeObj, int edge);

    // C++:  int edgeOrg(int edge, Point2f* orgpt = 0)
    private static native int edgeOrg_0(long nativeObj, int edge, double[] orgpt_out);
    private static native int edgeOrg_1(long nativeObj, int edge);

    // C++:  int findNearest(Point2f pt, Point2f* nearestPt = 0)
    private static native int findNearest_0(long nativeObj, double pt_x, double pt_y, double[] nearestPt_out);
    private static native int findNearest_1(long nativeObj, double pt_x, double pt_y);

    // C++:  int getEdge(int edge, int nextEdgeType)
    private static native int getEdge_0(long nativeObj, int edge, int nextEdgeType);

    // C++:  int insert(Point2f pt)
    private static native int insert_0(long nativeObj, double pt_x, double pt_y);

    // C++:  int locate(Point2f pt, int& edge, int& vertex)
    private static native int locate_0(long nativeObj, double pt_x, double pt_y, double[] edge_out, double[] vertex_out);

    // C++:  int nextEdge(int edge)
    private static native int nextEdge_0(long nativeObj, int edge);

    // C++:  int rotateEdge(int edge, int rotate)
    private static native int rotateEdge_0(long nativeObj, int edge, int rotate);

    // C++:  int symEdge(int edge)
    private static native int symEdge_0(long nativeObj, int edge);

    // C++:  void getEdgeList(vector_Vec4f& edgeList)
    private static native void getEdgeList_0(long nativeObj, long edgeList_mat_nativeObj);

    // C++:  void getLeadingEdgeList(vector_int& leadingEdgeList)
    private static native void getLeadingEdgeList_0(long nativeObj, long leadingEdgeList_mat_nativeObj);

    // C++:  void getTriangleList(vector_Vec6f& triangleList)
    private static native void getTriangleList_0(long nativeObj, long triangleList_mat_nativeObj);

    // C++:  void getVoronoiFacetList(vector_int idx, vector_vector_Point2f& facetList, vector_Point2f& facetCenters)
    private static native void getVoronoiFacetList_0(long nativeObj, long idx_mat_nativeObj, long facetList_mat_nativeObj, long facetCenters_mat_nativeObj);

    // C++:  void initDelaunay(Rect rect)
    private static native void initDelaunay_0(long nativeObj, int rect_x, int rect_y, int rect_width, int rect_height);

    // C++:  void insert(vector_Point2f ptvec)
    private static native void insert_1(long nativeObj, long ptvec_mat_nativeObj);

    // native support for java finalize()
    private static native void delete(long nativeObj);

}