Giter Club home page Giter Club logo

Comments (7)

t-paul avatar t-paul commented on July 19, 2024 2

Looks like it's also missing in the CheatSheet. It's not in the release version, only dev snapshots have it.

Created #5084 as reminder for the documentation.

from openscad.

t-paul avatar t-paul commented on July 19, 2024

Use swizzling:

v = [1, 2, 3];
echo(v.xx); // ECHO: [1, 1]
echo(v.yyy); // ECHO: [2, 2, 2]

from openscad.

khionu avatar khionu commented on July 19, 2024

I'm struggling to find documentation on this feature (and in general, actually). It's been hard to search for things because WikiBook's search doesn't limit the scope to the user manual.

from openscad.

khionu avatar khionu commented on July 19, 2024

Reflecting, I don't think swizzling helps here. I'm not starting with an existing vector, I'm trying to create a new vector from a number literal. I could see this maybe being helpful if I had a set of numbers I was going to splat from, but I'd be limited to only vectors with a length of three, and so I'd have to create ceil(N / 3) vectors.

from openscad.

nophead avatar nophead commented on July 19, 2024

Perhaps [val].xx and [val].xxx

from openscad.

t-paul avatar t-paul commented on July 19, 2024

echo([3].xxxx);
echo([for (n = [0,2,5,7,9]) [n].xxxx]);

The output limit for swizzling is 4 (inputs are xyzw and rgba).

from openscad.

khionu avatar khionu commented on July 19, 2024

Ahh, ok. I misread the docs on dot-access notation, and inferred that it wouldn't work on other-sized vectors.

This looks like it's sufficient to not need splat functions, thank you!

from openscad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.