YujiSODE / threeCellContour

Tool to extract contour from a image.
https://yujisode.github.io/threeCellContour/
MIT License
2 stars 0 forks source link

Sample results #5

Open YujiSODE opened 2 years ago

YujiSODE commented 2 years ago

sample results

YujiSODE commented 2 years ago

20211115sample01

YujiSODE commented 2 years ago

20211115sample02

YujiSODE commented 2 years ago

MandelbrotSet_Rosetta_Code_stroke

YujiSODE commented 2 years ago

original

imaginaryLandform_hex.js (Sode, 2018): the MIT License; https://gist.github.com/YujiSODE/e67e561b2e14dd84ff93efb672001bdb

imaginaryLandform_hex_js_strokef00 imaginaryLandform_hex_js_stroke000Above
YujiSODE commented 2 years ago

SS_3CC_sample01_v02_20211229_stroke SS_3CC_sample01_v02_20211229_strokeHull

//3CC_sample01_v02.js
//random sample
//
var sampleCode=()=>{
    let ctx=document.getElementById('threeCellContourCvs').getContext('2d'),
        W=ctx.canvas.width,H=ctx.canvas.height,
        R0=Math.sqrt(W*W+H*H),
        R=0.05*R0,
        X=0.0,Y=0.0,
        i=0,N=100;
    //
    const PI2=2.0*Math.PI;
    //
    ctx.fillStyle='#00ff';
    ctx.clearRect(0,0,W,H);
    ctx.beginPath();
    //
    while(i<N){
        X=W*Math.random();
        Y=H*Math.random();
        //
        ctx.moveTo(X,Y);
        ctx.arc(X,Y,R*Math.random(),0.0,PI2,false);
        ctx.fill();
        //
        i+=1;
    }
    ctx=W=H=R0=R=X=Y=i=N=null;
};
YujiSODE commented 2 years ago

vertices ≤ 2*N+1 when N = 36 sample: https://github.com/YujiSODE/threeCellContour/issues/5#issuecomment-1002969650

3CC_sample01_v03_hullN36

YujiSODE commented 2 years ago

vertices ≤ 2*N+1 when N = 15 sample: https://github.com/YujiSODE/threeCellContour/issues/5#issuecomment-1002969650

3CC_sample01_v03_hullN15

YujiSODE commented 2 years ago

vertices ≤ 2*N+1 when N = 2 sample: https://github.com/YujiSODE/threeCellContour/issues/5#issuecomment-1002969650

3CC_sample01_v03_hullN2

YujiSODE commented 2 years ago

vertices ≤ 2*N+1 when N = 1 sample: https://github.com/YujiSODE/threeCellContour/issues/5#issuecomment-1002969650

3CC_sample01_v03_hullN1

YujiSODE commented 2 years ago
//3CC_sample01_v03.js
//random sample
//
//function that draws sample data on canvas element
var SAMPLE=()=>{};
//
//n is sample set size
var setSample=(n)=>{
    let arr=[],i=0,N=Math.floor(n);
    N=N<1?1:N;
    //
    while(i<N){
        arr.push(Math.random(),Math.random(),Math.random());
        //
        i+=1;
    }
    //
    return ()=>{
        let ctx=document.getElementById('threeCellContourCvs').getContext('2d'),
            W=ctx.canvas.width,H=ctx.canvas.height,
            R0=Math.sqrt(W*W+H*H),
            R=0.025*R0,
            X=0.0,Y=0.0,
            i=0,n=arr.length;
            //
            const PI2=2.0*Math.PI;
            //
            ctx.fillStyle='#00ff';
            ctx.clearRect(0,0,W,H);
            ctx.beginPath();
            //
            while(i<n){
                X=W*arr[i];
                Y=H*arr[i+1];
                //
                ctx.moveTo(X,Y);
                ctx.arc(X,Y,R*arr[i+2],0.0,PI2,false);
                ctx.fill();
                //
                i+=3;
            }
        ctx=W=H=R0=R=X=Y=i=n=null;
    };
};
//
SAMPLE=setSample(100);
SAMPLE();
//
//=== to reset data set ===
//SAMPLE=setSample(sampleSize);
//=========================
YujiSODE commented 2 years ago

[v0.3]

vertices ≤ 2*N+1 sample: https://github.com/YujiSODE/threeCellContour/issues/5#issuecomment-1002969650 3CC_sample01_v03_20220109StrokeHulls_lowQuality

YujiSODE commented 2 years ago

[v0.3]

sample: https://github.com/YujiSODE/threeCellContour/issues/5#issuecomment-1002969650 3CC_sample01_v03_20220109Stroke_Fill

YujiSODE commented 2 years ago

OUTPUT_3CC20220704-01