14 February 2019 at 11:43 #5407hiteshnazcaParticipant
I am designing a waveguide which needs to have some holes (or rectangles) defined close to the waveguide. The holes need a period and also needs to go along the waveguide around the bends. I have an image attached below.
Could someone please guide me on how to achieve this on nazca?
Hitesh15 February 2019 at 00:26 #5412
It seems to me that the center path of the waveguide has to be defined like a polyline and a function is needed similar to the nazca internal function ‘polyline2polygon’ to add a width to the line. A width for the edge of the waveguide and a width for the path on which the circles/squares are to be placed. In curves some care needs to be taken for the distance of the circles on their path on the in and outside, I guess. No magic bullet, but no show-stoppers either.
Ronald25 June 2019 at 02:12 #5616
I would also be interested in designing something similar to this. How would you place the circle/squares along the path once it’s been created?
At the moment i’m thinking of using the nazca geometries library to create the shapes but I don’t see how I could place them periodically along a parametric path.
Paul25 June 2019 at 11:07 #561727 June 2019 at 17:00 #5622
I have found a quick and ugly way of doing it by calculating the line integral along the path. Whenever the distance gets bigger than an multiple of my desired spacing, I place the desired geometry. This works as long as the curve is defined with enough points.
xy = nd.curve2polyline(nd.sinebend_point, (100, 20, 0), 0.0001, (100, 20)) x, y = map(list, zip(*xy)) dl = 0 # element of length lint = 0 # total integral k = 1 spacing = 10 # desired spacing for i in range(1, len(y)): dl = np.sqrt((x[i] - x[i - 1]) ** 2 + (y[i] - y[i - 1]) ** 2) lint += dl if lint > k * spacing: hole.put(x[i], y[i]) k += 1 nd.export_plt()28 June 2019 at 10:31 #5631
That is a good first step. The question is what accuracy do you need? Reusing available modules may save you time and you may, therefore, look into computer vision and animation where arc length on a parametric curve is common (to determine the speed of a camera or other object for example).
Ronald28 June 2019 at 10:51 #5633
That’s a very good question, as I know that my current solution will only get me this far. But as you said it’s a first step and it allows me to push on with my design. What I like though, is that it should work for any path, not just the sbend shown here.
I’m still planning on looking at parametrizing the curve by arc length once I have more time. Will post the outcome here if successful.
- You must be logged in to reply to this topic.