Hi,
I was considering the scenario when I have the object and let say one single point/null next to it. And based on the distance between the null and my mesh I would like to delete the mesh points gradually. I tried xpresso a bit today with point node but I cant figured out how to do it.
It is custom to post either existing code or some sort of principal work when one asks for help in coding forums as people are usually happy to help with your problem but not willing to solve it for you. So show us what you got ;)
From my understanding I would need position attribute from my mesh points and the distance from my null to the mesh as a variables and then I can run if condition saying if the distance is less then something remove points from my geo.
You have three points: The origin of your null object (A), the origin of your polygon object (B) and the vertex point (C) in your polygon object you want to evaluate for deletion. From your wording I assume you want the orthogonal projection of C onto the line segment AB (i.e sample the linear volumetric gradient G spanned between the points A and B at the position of your vertex point C). The magnitude of AB proposed by you is a constant and the magnitude of AC depends on the topology of your polygon object and is probably not what you mean by gradually. The Python SDK offers c4d.utils.PointLineSegmentDistance()
for line segment projections.
There is also more ambiguity in your wording when you say gradually. Since deletion is a binary decision (you either do it or you don't) you need a third component to determine if you want to delete a point. You could get extra fancy here, but the most straight forward thing would be to just generate a random number based on C.The full decision to delete a point would be then something like this (in pseudo code):
if gradient(a, b, c) * random(c) > threshold: #threshold could be .5 for example
delete(c)
Cheers
zipit