Home Forums Nazca Need to define periodic holes next to the waveguide

Viewing 7 posts - 1 through 7 (of 7 total)
• Author
Posts
• #5407
hiteshnazca
Participant

Hi everyone,

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.

https://imgur.com/a/C7gIgsF

Could someone please guide me on how to achieve this on nazca?

Thanks.

Best,

Hitesh

#5412
Ronald
Keymaster

Dear Hitesh,

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.

Ronald

#5616
paul
Member

Hi,

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.

cheers,

Paul

#5617
Ronald
Keymaster

Dear Paul,

If you have a parametric curve p(t) = (x(t), y(t)), then for periodic placement (of cells) along the curve you would have to
reparameterize the curve by arc length. A pdf on this can be found e.g. here or here.

Ronald

#5622
paul
Member

Thanks Ronald,

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()``````
#5631
Ronald
Keymaster

Dear Paul,

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).

See for example opencv:
https://pypi.org/project/opencv-python/
https://opencv.org/opencv-2-4-8/

Ronald

#5633
paul
Member

Hi Ronald,

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.

Cheers,

Paul

Viewing 7 posts - 1 through 7 (of 7 total)
• You must be logged in to reply to this topic.