Code Monkey home page Code Monkey logo

Comments (5)

stephomi avatar stephomi commented on July 16, 2024

Sorry I don't maintain sculptgl anymore!

from sculptgl.

nesquik011 avatar nesquik011 commented on July 16, 2024

@stephomi ok thank you , if you don't want to work anymore with the project , so kindly can you give me hints how to add that option ?

from sculptgl.

stephomi avatar stephomi commented on July 16, 2024

I don't mind answering specific question but this one is too general/complex.
User input (interaction), rendering (the lasso), etc...

However, I can answer for the polygon/lasso thing:

from sculptgl.

nesquik011 avatar nesquik011 commented on July 16, 2024

@stephomi great thank you a lot for respond , how to finding shortest path using two points on mesh ? cos expect any librabry or good algorithm, otherwise browser will crash with high cpu

from sculptgl.

stephomi avatar stephomi commented on July 16, 2024

For that problem, you should probably look into A* algorithm.
It shouldn't be that expensive, but it depends of the mesh topology and polycount.

By the way you should proably ignore my previous message on the lasso/polygon thing.
I though you wanted to draw the lasso in screenspace independently of the mesh (for example like the blender selection tool).

In that case you indeed need to know the shortest points between 2 vertices.
Once you got these paths, and if your path is closed (important), simply tags all the vertices, and flood fill all the vertices inside.
It's a bit similar to this part

for (var i = 0; i < acc; ++i) {
var id = pickedVertices[i];
var start, end;
if (ringVerts) {
vertRingVert = ringVerts[id];
start = 0;
end = vertRingVert.length;
} else {
start = vrvStartCount[id * 2];
end = start + vrvStartCount[id * 2 + 1];
}
for (var j = start; j < end; ++j) {
var idv = vertRingVert[j];
if (vertTagFlags[idv] === tagFlag)
continue;
vertTagFlags[idv] = tagFlag;
var id3 = idv * 3;
var dx = itx - vAr[id3];
var dy = ity - vAr[id3 + 1];
var dz = itz - vAr[id3 + 2];
if ((dx * dx + dy * dy + dz * dz) > rLocal2)
continue;
vertSculptFlags[idv] = sculptFlag;
pickedVertices[acc++] = idv;
}
}

from sculptgl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.