## Equation solver , find intersection from infinite line to shape vba/java

## Equation solver , find intersection from infinite line to shape vba/java

(OP)

I'm trying to implement this situation inside an actual VBA/java program.

https://www.geogebra.org/calculator/qranh66u

I need to acquire the intersections point created by the shape and the intersection line. I surfed the web and studied newton's method and other approaches, but they seem all too complex or hardly implementable.

Is there a way to find the intersection point given the equation you see in the link?

From eq1 to f, I have to find A and B

for example:

eq1: (((abs(x))/(a)))^(2 ((a)/(r)))+(((abs(y))/(b)))^(2 ((b)/(r)))=1

intersection with

f: y=tan(15 ((π)/(180))) x

when a = 900

and b = 400

and r=5

it

generates

POINT A (-4,-1.07) and point B ( 4+1.07)

I need to implement this function in a program, so when I change "f" or "eq1" parameters I get the new points

Java or VBA but VBA is preferable

So if you can give me some info, or at least where to watch it would be great. Thanks!

https://www.geogebra.org/calculator/qranh66u

I need to acquire the intersections point created by the shape and the intersection line. I surfed the web and studied newton's method and other approaches, but they seem all too complex or hardly implementable.

Is there a way to find the intersection point given the equation you see in the link?

From eq1 to f, I have to find A and B

for example:

eq1: (((abs(x))/(a)))^(2 ((a)/(r)))+(((abs(y))/(b)))^(2 ((b)/(r)))=1

intersection with

f: y=tan(15 ((π)/(180))) x

when a = 900

and b = 400

and r=5

it

generates

POINT A (-4,-1.07) and point B ( 4+1.07)

I need to implement this function in a program, so when I change "f" or "eq1" parameters I get the new points

Java or VBA but VBA is preferable

So if you can give me some info, or at least where to watch it would be great. Thanks!

## RE: Equation solver , find intersection from infinite line to shape vba/java

Links in code to certain articles/algorithms on which it is based

Code could definitely be simplified, I tend to refactor a lot of stuff so I can use it in multiple functions without repeating.

Try this:-

Link to example

## CODE --> VBA

https://engineervsheep.com

## RE: Equation solver , find intersection from infinite line to shape vba/java

https://newtonexcelbach.com/2018/12/27/more-update...

To use either of these for the problem in the original post the coordinates need to be defined for all of the lines to be intersected, and the formula generating the "rectangular" shape involves very high powers that are likely to cause numerical problems with most equation solvers.

Because in this case the rectangle is vertical, if the x value of the vertical legs can be found it is a simple matter of substituting that into the equation for the sloping line.

By trial and error (and looking at the results in the link) I found that for the given a, b and r values the vertical legs of the rectangle are at x = +-900 and the intersection points are therefore at y = +-241.1542732

Excel goalseek also (eventually) came up with a result close to x=900 for the vertical lines.

I'm wondering if the example is a practical problem, or just one taken from the link? For most problems involving intersections of curvilinear equations there are automated numerical solutions that will work better than they do for this case.

Doug Jenkins

Interactive Design Services

http://newtonexcelbach.wordpress.com/

## RE: Equation solver , find intersection from infinite line to shape vba/java

Unless the sloping line misses one or both vertical parts of the rectangle and that is important?

Then you'll get a result by substituting the X value, but it will be incorrect assuming Olivia86 is after the exact intersections. Like you I don't know if this is simply a pure geometry problem, or a way of solving another separate problem by utilising the geometry. Your suggestion may be appropriate within the bound of the problem the OP is trying to solve, but you need to be aware of the potential to report an incorrect result if intersections with the horizontal part of the rectangle are important tot the solution?

https://engineervsheep.com

## RE: Equation solver , find intersection from infinite line to shape vba/java

Sure, but if you have the coordinates of the four corners it's easy to check for that, and if you don't you can't use our intersection spreadsheets either.

Doug Jenkins

Interactive Design Services

http://newtonexcelbach.wordpress.com/

## RE: Equation solver , find intersection from infinite line to shape vba/java

Actually, I'm just using X= 900 and X=900, finding the intersection of y=mx and x=y/m, then I'm setting the boundary to exit the various loop. But I'm still in developing, it's just conceptual.