# Conditional reflection using polar coordinates

praveen2600 shared this question 2 years ago

I am trying to reflect point D" if it is in the certain polar quadrant. I am using

If[(10;180+α)<D"<(10;360°),Reflect[D'', a]]

Where alpha is already defined and a is a line. Whats wrong with the above code? It is not executing. 1. If[(10;180°+α°)<D"<(10;360°),Reflect[D'', a]]

If[α<angle(D")<360°,Reflect[D'', a]] 1

You should attach here your file to allow us to make a better troubleshooting.

Also, you should use a different inequality to define the condition for D'' because it's not possible to compare the position of two points just using > or <.

Perhaps something like If[180°+α<y(D")<360°,Reflect[D'', a]] if the first coordinate of D'' is constant.

and please use the degree symbol for angles if those are defined as angles and not as numbers on a slider.

Of course these are just general hints, based on what you wrote here. I don't know how you built the file. 1

Attaching my code file to support the question. What I want is to replace

D"'= Reflect[D",b]

with

D"'= If[(10;180°+α°)<D"<(10;360°),Reflect[D'', a]] 1

Thanks Simona.

Do you mean that inequality < or > can be used only if D" is a fixed point? I defined D as a point on a bisector of lines.

Also, what is counter part of y(D") for polar coordinates. In other words, how can I extract angle information from (r,theta) coordinates?  1

A Point (or Vector) can not be biger or smaller then a Point (or Vector) (see Simona)

(only scalar-values = values with 1 dimension can be biger or smaller then others scalar-values)

But the Angle of a Vector (this is a scalar-value) can be biger or smaller then an other Angle of a Vector.

Note: In your description nothing is declare for the elese-case. 1

Thanks Rami. I have put my code in reply to Simona. May be that should clear my question. 1

Is it necessary to declare a n "else-case" while using If condition? I dnot want to do anything if condition is not satisfied. 1

The Questions are:

If your condition not is true: exist a point D''' or not.

- And if not exist D''': has no dependencies or when has dependencies what are the rules

- And if exist D''' (in all cases): what is the rule (if your condition is not true)

Example:

If the condition not is true, then D''' not exist and (if has) all dependencies also not exist.

Then the Syntax is: D'''=If[<condition>, <true-case>] (as your example)

For other Syntax see my last example.

.

Note-1: I'm not sure, but maybe the idea of your condition is not what you want. Maybe make a description in normal sentences (not in GGB-syntax). And / or make a description what is the sense of this construction. It seems important to me: the description (of condition) is understandable for everyone without mathematical or syntax knowledge.

.

Note-2: I think it's a good idea if you study and understand the code of my last example (Point E).

I think with this example you can find your own, correct solution.

.

Note 3:

Also the ideas of Simona (working with y-value from D'' or bether from D''') can be a (easy) way for a solution. 1

Yes I saw your E point. Thanks for a detailed answer. Angle(D") worked for me as pointed out by mathmagic.  1

1. If[(10;180°+α°)<D"<(10;360°),Reflect[D'', a]]

If[α<angle(D")<360°,Reflect[D'', a]]