Angle mask by angle
This commit is contained in:
parent
1e90948581
commit
9cbe38359c
@ -116,8 +116,6 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
System.out.println("PARSE " + input);
|
||||
|
||||
try {
|
||||
return Double.parseDouble(input);
|
||||
} catch (NumberFormatException e1) {
|
||||
|
@ -252,8 +252,16 @@ public class DefaultMaskParser extends FaweParser<Mask> {
|
||||
throw new SuggestInputParseException(input, "/<min-angle>:<max-angle>");
|
||||
}
|
||||
try {
|
||||
int y1 = (int) (Expression.compile(split[0]).evaluate());
|
||||
int y2 = (int) (Expression.compile(split[1]).evaluate());
|
||||
int y1,y2;
|
||||
if (split[0].endsWith("d")) {
|
||||
double y1d = Expression.compile(split[0].substring(0, split[0].length() - 1)).evaluate();
|
||||
double y2d = Expression.compile(split[1].substring(0, split[1].length() - 1)).evaluate();
|
||||
y1 = (int) Math.round(Math.tan(y1d * (Math.PI / 180)));
|
||||
y2 = (int) Math.round(Math.tan(y2d * (Math.PI / 180)));
|
||||
} else {
|
||||
y1 = (int) (Expression.compile(split[0]).evaluate());
|
||||
y2 = (int) (Expression.compile(split[1]).evaluate());
|
||||
}
|
||||
return new AngleMask(extent, y1, y2);
|
||||
} catch (NumberFormatException | ExpressionException e) {
|
||||
throw new SuggestInputParseException(input, "/<min-angle>:<max-angle>");
|
||||
|
Loading…
Reference in New Issue
Block a user