Jump to content

back face deleting from other object


murathan altunsoy

Recommended Posts

You don't need last cycle. It's repeating same thing N times. Delete it and everything will work fast.

For the minor improvements, there is no need to expand all points into 0..@numpt range array simply to iterate over it. Use regular for loop. uzak doesn't need to be array to find minimum from it. Override existing minimum inside loop.

float uzak = 1;

for (int i = 0; i < npoints(1); i++)
{
    vector pos = point(1, "P", i);
    float query = dot(@N, normalize(@P - pos));
    uzak = min(uzak, query);
}

if (uzak > 0)
    removepoint(0, @ptnum);

 

uzak.hipnc

Edited by f1480187
  • Like 1
Link to comment
Share on other sites

18 minutes ago, f1480187 said:

You don't need last cycle. It's repeating same thing N times. Delete it and everything will work fast.

For the minor improvements, there is no need to expand all points into 0..@numpt range array simply to iterate over it. Use regular for loop. uzak doesn't need to be array to find minimum from it. Override existing minimum inside loop.


float uzak = 1;

for (int i = 0; i < npoints(1); i++)
{
    vector pos = point(1, "P", i);
    float query = dot(@N, normalize(@P - pos));
    uzak = min(uzak, query);
}

if (uzak > 0)
    removepoint(0, @ptnum);

 

uzak.hipnc

Thank you F1. This is  really good answer.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...