walt.farrell Posted December 1, 2018 Posted December 1, 2018 There's another report regarding "sqrt(2)" not working, but "*sqrt(2)" working. That is, functions that result in a constant (e.g., 1.414) are not being processed, but functions used in an expression based on the image dimensions (H, W) do work. -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Laptop 2: Windows 11 Pro 24H2, 16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU iPad: iPad Pro M1, 12.9": iPadOS 18.2.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1
Staff Sean P Posted December 3, 2018 Staff Posted December 3, 2018 On 12/1/2018 at 1:36 PM, >|< said: According to the app Help, expressions support the inverse trig functions asin, acos and atan. What topic of the help is that? The only ones listed in Expressions for Field Input are Sin, Cos and Tan.
v_kyr Posted December 3, 2018 Posted December 3, 2018 Those are only listed among the APhoto help, but not for the ADesigner help, see here for APh. ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
Staff Sean P Posted December 3, 2018 Staff Posted December 3, 2018 Thanks for that! It could be the asin/acos/atan are primarily designed for use in the Equations and Procedural Texture filters. I shall double check with development! EDIT: I have a feeling this could be the same as the issue Walt mentioned above so I've passed it on to development. Average(5,10) was also failing for me!
Staff Ben Posted December 4, 2018 Staff Posted December 4, 2018 This is because the functions listed above all output a pure number. We don't then promote the pure number to a measurement. What should the measurement be?? You can explicitly add a unit type to a result - if you put in "average(5,10) mm" you will get the answer 7.5mm. "*sqrt(2)" works because it is multiplying the current value (which has units) by root 2. The answer adopts the units of the current value - so this works. It's the same as if you wrote "*2". Also - trig functions that return an angle won't work in a field that requires a distance value. So, for example, you can't use "atan2(h,w)" in the X field. You would have to convert the value by using another trig function (such as cos). There are a number of rules we have for how functions and operators adopt or change unit types. I'll make sure these are in the documentation as soon as I can. It is possible that I'll add back in the promotion of pure values to the current document unit type. That won't work mid-expression though. For example "average(w,2)" won't be allowed because w has units and 2 is pure. We used to allow promotion to unit type inside of function calls, but that had too much potential for confusion. Results from simple operators (+ - * /) will allow promotion to current unit type. A short list of how unit types are promoted: *2, /2, +=2, -=2 - Unit type taken from existing value. x+2, x-2, 2+x, 2-x - Special case, 2 is promoted to the unit type of x, before addition or subtraction. Result is in unit type of 'x'. x*2, 2*x, x/2 - Unit type taken from type of 'x'. x*y - Technically the unit type should be an area, but we just promote to the uni type of the left hand value. x/y - Result is a pure number (technically a ratio, and has no unit type). The result will not be automatically promoted to a unit type. 2/x - Not allowed, unless x is a pure value Result from trig functions sin, cos, tan - take an angle (assumed to be degrees unless you use deg or rad unit type), and outputs a pure number. acos, asin, atan - the inputs must be pure values, the output is an angle. atan2 - the inputs must both be pure, or both a distance type. The output is an angle. Result from other functions sqrt(2) - result is a pure number. sqrt(x) - result adopts the unit type of 'x'. sqrt(100mm) - result would be 10mm. sqrt(100) mm - The result is explicitly promoted to mm, so the result is 10mm. walt.farrell, Gear maker and Max P 1 2 SerifLabs team - Affinity Developer Software engineer - Photographer - Guitarist - Philosopher iMac 27" Retina 5K (Late 2015), 4.0GHz i7, AMD Radeon R9 M395 MacBook (Early 2015), 1.3GHz Core M, Intel HD 5300 iPad Pro 10.5", 256GB
Staff Ben Posted December 4, 2018 Staff Posted December 4, 2018 On 12/1/2018 at 1:36 PM, >|< said: AD 1.7.0.3 macOS 10.13.6 According to the app Help, expressions support the inverse trig functions asin, acos and atan. The inclusion of an inverse trig function in a field of Transform panel results in no change to the previous value in the field. For example, asin(0.5)*10 entered into the H field is not evaluated. Just to add - your example "asin(0.5)*10" results in an angle value - the H field is a position/size field so only takes distance units for a result. If you need to convert an angle to a scalar (pure number), you will need to divide it - for example, "asin(0.5)/1deg". SerifLabs team - Affinity Developer Software engineer - Photographer - Guitarist - Philosopher iMac 27" Retina 5K (Late 2015), 4.0GHz i7, AMD Radeon R9 M395 MacBook (Early 2015), 1.3GHz Core M, Intel HD 5300 iPad Pro 10.5", 256GB
Staff Ben Posted December 5, 2018 Staff Posted December 5, 2018 ok - but what is the pure number? For trig functions do you expect it in degrees or radians? Our angle type allows for conversion between degrees and radians internally, but to convert it to a pure number you need some notion of what angular units you are using. All the C functions we call work in radians. SerifLabs team - Affinity Developer Software engineer - Photographer - Guitarist - Philosopher iMac 27" Retina 5K (Late 2015), 4.0GHz i7, AMD Radeon R9 M395 MacBook (Early 2015), 1.3GHz Core M, Intel HD 5300 iPad Pro 10.5", 256GB
fde101 Posted December 5, 2018 Posted December 5, 2018 Angles should be measured in hours, minutes, and seconds. 0 degrees = 12:00:00 90 degrees = 3:00:00 180 degrees = 6:00:00 270 degrees = 9:00:00 etc.
Recommended Posts