How to join lines to get a shape

Sir Knowledge increase by sharing instead of commenting you should help juniors to promt as @prisoner849 and @EliasHasle is doing they only share the ways and i am fitting them as best as possible they are only giving me 1% hint rest i manage if you have enough knowledge and dont want to share to keep it in your pocket instead of commenting in other business

OK.

My suggestion was not about optimization. It regarded dragging the nearest vertex when you “miss”, as you clearly expressed an interest for earlier.

(ehm!)

yes now i am able to select it but the draging stops i need the reason for it whats wrong here in my code and as you said use container instead of event so i check that canvas is the root element here and i have canvas.ClientHeight like this but it does not work
mouse.x = ( container.getRenderer().domElement.clientWidth / window.innerWidth ) * 2 - 1;

Why not post a jsfiddle that demonstrates the problem?

PS: I have to point out that that line is wrong in at least two ways: First, it no longer refers to the event coordinate, second, it still divides by window width.

Here https://jsfiddle.net/7rgh4jb9/12/

1 Like

if (vertex || !dragging) return;
should be
if (!vertex || !dragging) return;

2 Likes

ohhh gosh minnor mistake thanks guzs for helping finally i have the polygon tool as i wish a special thanks to @prisoner849 and @EliasHasle

2 Likes

@EliasHasle i want to customize the polygon in your shared fiddle https://jsfiddle.net/prisoner849/snyqgmke/ means i want to add dynamically an point by mouse click so it turns into 4 points or any where i can add the point whats the best approach according to you

That fiddle is by @prisoner849

1 Like

@Yash_Joshi
Why are you still referencing to that fiddle? Seems it’s totally different from what you try to achieve.

Could you provide at least explanatory pictures of the desired result? As it’s hard to understand what you mean with your description.

ok still any best way that you have for this issue

Didn’t you ask for this exact thing before, and get a bunch of helpful answers from me and @prisoner849? Just read through the thread again to see if you get some ideas. I am sure, with the added experience since then, you will get more value out of the previous suggestions.

ok @EliasHasle and @prisoner849 i am close to solution guzs but i have a question let say
i have a polygon with the points (2,0,5), (3,0,2),(5,0,5) i am getting a polygon (triangle) while using raycasting i am unable to pick the line on with i clicked it gives me all the lines i need a perfection in line picking any solution ?

fixed already thanks for attention guzs :slight_smile:

@EliasHasle and @prisoner849 i need your help guys , now i want to export this polygon in json format you already aware about how we are creating polygons and than does the import is available and also i have custom geometries so i want there export and import too

What’s the difficulty? You’ve got an object of a polygon with all its info, so you can export it in any format you want.

ok now my question if i export it so while importing i think we need our own mechanism to re create it because i think three js dont have such options for custom geometry and i am now storing it in DB its points but it take time in recreation i want to reduce that time like if a user reload so example it take it from session some thing like this or from a temp file

The more information about an object and its parts you export, the more precise you can re-create it on import.

How do those things relate to Three.js?

1 Like

@prisoner849 in our polygon if i need a inside or outside offset than is there any way possible like if i give 1 unit so it create an offet at one unit