Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
The Internet Math Programming Technology

CSS To Get Support For Trigonometry Functions (zdnet.com) 135

CSS, or the language that styles and arranges how page elements appear on a website, will soon get support for trigonometry functions such as sine, cosine, tangent, and others, ZDNet is reporting. From the report: The new trigonometry functions were approved at the end of February in a meeting of the World Wide Web Consortium (W3C) CSS Working Group. The new functions approved and set to join the CSS standard are: Sine - sin(), cosine - cos(), tangent - tan(), arccosine - acos(), arcsine - asin(), arctangent - atan(), arctangent (of two numbers x and y) - atan2(), square root - sqrt(), square root of the sum of squares of its arguments - hypot(), and power of - pow().
This discussion has been archived. No new comments can be posted.

CSS To Get Support For Trigonometry Functions

Comments Filter:
  • pfft (Score:4, Funny)

    by cascadingstylesheet ( 140919 ) on Monday March 11, 2019 @12:48PM (#58253976) Journal
    Can it do statistics? That's what I want to know ...
  • Seriously, why? CSS is meant to make pages prettier. Does it need math functions? Are they going to make turing complete?
    • CSS is meant to make pages prettier.

      That's one thing it can do, but CSS is also the main tool for setting up different page layouts, and not everything has to be a rectangular grid.

    • Re:Why? (Score:5, Informative)

      by GeLeTo ( 527660 ) on Monday March 11, 2019 @12:59PM (#58254076)
      This is needed for CSS animations. Now you can do some things like moving an object along a sine path with CSS transitions, but this will be more powerful and in many cases - more intuitive.
      • Re: (Score:3, Insightful)

        by Anonymous Coward

        Great, because the average webpage didn't use enough CPU time without this.

        • by Anonymous Coward

          Trig functions are stupid easy for CPUs to work with. 15 years ago we were well into the era when many games were using trig to transform audio in real-time purely in software. Even today's el cheapo smartphones would brush that off, and that's way more complex than what your typical web developer would need.

          • by Anonymous Coward

            Trig functions are stupid easy for CPUs to work with. 15 years ago we were well into the era when many games were using trig to transform audio in real-time purely in software. Even today's el cheapo smartphones would brush that off, and that's way more complex than what your typical web developer would need.

            Said nobody ever.

            While you can use lookup tables for stupidly fast sine, cosine and tangent functions you still have to do the hard yards for sqrt(). This is why most game engines doing bounds checks don't use c = sqrt((a * a) + (b * b)), they put up with cSquared = (a * a) + (b * b). Same result list, much cheaper maths.

        • by SirSlud ( 67381 )

          Unless you're doing something truly weird, your CPU isn't spending much time at all on even heavy web browsing. Even the heaviest of web pages are not going to exceed a few % usage of your cpu. A lot of people around here seem to base a lot of their perceptions and priorities on what things were like 15 years ago.

          • Re:Why? (Score:5, Funny)

            by slack_justyb ( 862874 ) on Monday March 11, 2019 @02:46PM (#58254992)

            A lot of people around here seem to base a lot of their perceptions and priorities on what things were like 15 years ago.

            That's pretty much Slashdot in a nutshell. Shoot, say something like systemd, wayland, Java performance, IPv6 deployment, or cloud computing and you're likely to get a stack of punch cards thrown at you for being a heretic.

            • Re:Why? (Score:4, Funny)

              by Chelloveck ( 14643 ) on Monday March 11, 2019 @04:01PM (#58255788)

              That's pretty much Slashdot in a nutshell. Shoot, say something like systemd, wayland, Java performance, IPv6 deployment, or cloud computing and you're likely to get a stack of punch cards thrown at you for being a heretic.

              Punch cards? Damned whippersnappers. Paper tape is all you need you little snots! Now, get off my lawn!

          • Unless you're doing something truly weird, your CPU isn't spending much time at all on even heavy web browsing. Even the heaviest of web pages are not going to exceed a few % usage of your cpu. A lot of people around here seem to base a lot of their perceptions and priorities on what things were like 15 years ago.

            Percentages might look low but typically it's because only a single thread of execution is being utilized. I routinely find myself in CPU limited territory when viewing large tables of data from browser.

      • More importantly, if you have sine, you can easily incorporates circles into your layout. A whole new class of stylish but unintuitive interface is open now!

      • Ho nice! It will be easier to add more useless animations that add _nothing_ useful to web pages. Please add bouncing cats all over the web pages! :)

      • by Anonymous Coward

        You're doing it wrong.

        CSS is a declarative language for layout. It works ok for static layouts. Dynamic elements stretch its limits - simple things are doable, but the complexity ramps up quickly. If you're using it for animation, you're using the wrong tool for the job.

        To web developers, CSS is like XML (and violence): if it doesn't solve your problem, just use more. A pox on the lot of them.

        • by tepples ( 727027 )

          If you're using it for animation, you're using the wrong tool for the job.

          Then what is the right tool for the job, particularly if you're site's audience includes the sort of "I don't want any script in the browser, ever" tech purists who inhabit Slashdot?

          • by Anonymous Coward

            Do you think turning CSS into Javascript will please the people who don't want to run Javascript, or just sour them on CSS?

          • Maybe they could create a new browser-specific language designed to handle trivial in-page tasks, and ONLY trivial in-page tasks?

            You know, like Javascript *used* to be before they kept extending it and extending it beyond all reasonable limits and turning it into the ginormous mess that people are now trying to get away from?

            "Mod it till it breaks" is fine for Bethesda games, but it's been a never ending series of trainwrecks in the rest of the computer industry.

          • by DeVilla ( 4563 )

            Actually, I was assuming something similar. The "I don't want any script in the browser, ever" crowd is the eventual target as the slowly add enough to be able to do the things in CSS that people hates flash & javascript for. They aren't there yet, but I wonder how far they are from it?

            Can they implement CSS "Punch the monkey"? Can they embed CSS tracking IDs? Can they obscure link actual link targets with it? Can the exfiltrate information with it?

      • No, it is NOT needed. You should be doing this in JavaScript -- not in a (static) layout language.

        Where will this bloat end? Adding a scripting language??? Because there will always be some "wouldn't it be nice to be able to do ...". We _already_ have requestAnimationFrame [mozilla.org] for smooth, jank free 120 Hz animation. To see if your browser supports 120 fps check use testufo [testufo.com].

        • by tepples ( 727027 )

          We _already_ have requestAnimationFrame

          Not if the user has chosen to disable script on your site for any of several reasons:

          - Wanting to maintain a sense of separation between documents, which ought to be static on the client side (even if they are dynamic on the server side), and applications, which ought to be native and downloadable
          - Fear of being tracked, particularly through the subpoena exception in every privacy policy
          - Your scripts not having been marked as licensed under a free software license [gnu.org]

        • If you're doing 3d transformations in CSS, these are very helpful.

          • Heck, they're very useful for 2D transformations. It's almost impossible to rotate something in 2D without using trig.

            Frankly, I'd say anyone who works with computer generated/animated graphics, and doesn't already understand the usage and value of trig functions, has missed an incredibly important part of their education that should be rectified as soon as possible.

      • Please don't say that animations make things more intuitive. Every web page today is trying desperately to mimic what they were doing in Flash 15 years ago, and it's not any more intuitive today using HTML5 than it was back then using single-threaded proprietary technology.

    • Seriously, why? CSS is meant to make pages prettier. Does it need math functions? Are they going to make turing complete?

      You do realize that EVERYTHING on a computer is a math function sooner or later, right? Any why not have math functions? Just because you can't think of a use for it doesn't mean nobody else can. SVG and MathML make use of CSS and the utility there seems fairly straightforward. Can you not imagine CSS math functions being used to display math data better than it is now?

    • Because any time you want to move or place anything in a not-perfectly-vertical-or-horizontal straight line, trigonometry is the natural solution. You can kludge together various alternatives, but trig handles everything seamlessly and consistently. They are the fundamental tools necessary for translating back and forth between rectangular grid coordinates, and angle-and-distance polar coordinates.

      You can do computer graphics and animations without them, but it's like juggling with your hands tied behind

    • Writing games.
  • by xack ( 5304745 ) on Monday March 11, 2019 @12:59PM (#58254068)
    Whats with all the js, css, wasm, webgl malware vectors, but hey no more flash right?
    • Forget cyptocurrency.

      Just wait until CSS has new features designed SPECIFICALLY to support advertising! It will be amazing and wonderful! Ads like you've never seen before! Especially if CSS can pull in ads with executable code from third party web sites!
    • And finally hack NASA with HTML.
  • interesting (Score:3, Insightful)

    by Anonymous Coward on Monday March 11, 2019 @01:00PM (#58254080)

    Taking javascript out of the equation is more than welcome.

    • Until CSS becomes the next Javascript cause people keep feeling the need to extend it well beyond what it was ever intended to go.

      Kinda like what happened to Javascript, as a matter of fact.

  • Objokes (Score:5, Funny)

    by nospam007 ( 722110 ) * on Monday March 11, 2019 @01:26PM (#58254338)

    A nerd was invited to compete in the Trigonometry Mathletic Competition...
    he said:
    "Sine me up!"

    Catholics fail trigonometry because they're afraid of sin
    Irish people fail trigonometry because they can't tan.
    Everyone else fails trigonometry just cos.

    My girlfriend has a trigonometry fetish.
    Every time we talk, she gets off on a tangent.

    My teacher frowned at me when I handed in my trigonometry test paper.
    I don't think that's a good sine

    • by Anonymous Coward

      Trigonometry puns are a sine of insanity.

    • by Opyros ( 1153335 )
      You paddle out, turn around and raise,
      And baby, that's all there is to the cosine craze
      -The Beach Boys

      (O.K., I know the lyric is supposed to be "coastline", but that's how it always sounds to me.)
  • While the study of these functions is called "trigonometry", the functions themselves are called trigonometric.
  • [css-values] Trigonometric functions #2331 [github.com]

    The contributor documents potential use cases in his opening post, and a little later on, the irc log is visible

    AmeliaBR: Once you start doing graphical layouts involving arcs and stuff, you need trig functions to convert from width/height distances to angular distances

    • Re: (Score:1, Flamebait)

      by lgw ( 121541 )

      AmeliaBR: Once you start doing graphical layouts involving arcs and stuff, you need trig functions to convert from width/height distances to angular distances

      Translation: my website is only massively annoying. I need it to be even more annoying than previously thought possible, and the CPU need to be pegged permanently at 100%.

  • by DontBeAMoran ( 4843879 ) on Monday March 11, 2019 @01:35PM (#58254410)

    How about adding support for simple constants first?!

    const myColor=#0F0;

    body
    {
    background: myColor;
    }

    Yes, I know... CSS pre-processors, yadda yadda yadda... but every time you add a tool to your system, it's another security risk, another thing to slow your system down.

  • CSS isn't bloated enough. It also needs HTML support. I'm looking forward.
  • Comment removed based on user account deletion
  • So I guess that trig I learned WILL be useful in my life.
  • The real question is, when will I get support for trig functions?

    • As soon as you sit down and learn them. Here, this image contains most of the information that you need to effectively use basic trig, and will help you to visualize how the primary trig functions interact: https://commons.wikimedia.org/... [wikimedia.org]

      sine and cosine are probably the most important ones, as they decompose angle-and-distance polar coordinates into (x,y) rectangular ones, and it's extremely difficult to perform rotations or general-case not-perfectly-horizontal-or-vertical translations without them.

  • Now, can we get support for doing basic shit like being able to calculate the height of a dynamic element without having to resort to javascript hacks?
  • by Medievalist ( 16032 ) on Monday March 11, 2019 @03:19PM (#58255332)

    The file upload button is unstylable. People write crazy amounts of browser-specific code to get around this - literally hundreds of lines of code, if you want to work responsively in all current browsers - because every other button can have style applied to it, but file upload buttons can't.

    Seriously. Working on trig functions when they haven't finished with buttons yet? That seems really strange to me.

  • Great so now things will be even slower and more CPU intensive just so we can put more rounded edges and stupid starwipes into what should be simple interfaces.

I program, therefore I am.

Working...