Skip to content
Advertisement

Remove the intersection between two curves

I’m having a curve (parabol) from 0 to 1 on both axes as follows:

enter image description here

I generate another curve by moving the original curve along the x-axis and combine both to get the following graph:

enter image description here

How can I remove the intersected section to have only the double bottoms pattern like this:

enter image description here

The code I use for the graph:

JavaScript

I’m doing a research on pattern analysis that requires me to generate patterns with mathematical functions.

Could you show me a way to achieve this? Thank you!

Advertisement

Answer

First off, I would have two different parabola functions such that:

JavaScript

You can choose your own offsets for y1 and y2 depending on your needs.

And then it’s simply take the min of the two arrays

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement