Suppose you receive a job offer in a new city. Your new job will give you a raise by 10%. But will you be better off financially after moving to that city after taking into consideration its cost of living?
The website Expatistan has information about prices from over 320 cities around the world. Each city has a list of over 50 items and their corresponding prices. The website takes those items and prices and gives us a value for the price index of each city.
I decided to take the idea of this website and extend it by building a model to predict the cost of living index of any city in the world.
In order train my model, I needed to get data. I used Python’s BeautifulSoup library to build a web scraper, to scrape 320 individual city pages from Expatistan’s website. I extracted the item names and item prices from each page and loaded the data into a Pandas data frame.
I cleaned up the data and built my model. I used scikit-learn to perform a linear regression to calculate the coefficients for my model. Here are the results of my model.
I reverse engineered the website’s model. I was able to perfectly predict a city’s price index!
However, my goal was to be able to use this model on all cities, not only the cities included on the website. The problem with this is that I need 50 prices of all sorts of items from in categories from food, housing, clothing, transportation, health, and entertainment. For some of these items would be nearly impossible to get their prices. There is no reliable to place to find the price of 1 pair of men’s leather business shoes or Short visit to private Doctor. I went item-by-item and kept only the items for which I could easily find their prices.
I was left with only six items: gasoline, rental housing, fast food, public transportation, internet, and automobiles. I had to build a new model with the combination of these items. I also created a new feature called “region” that was based on the location of the city because I thought location would affect a city’s price index.
I was skeptical whether a new model using only seven items would be very predictive. I noticed that rent was highly correlated to price index and I built a test model using only this single feature. It turns out that rent by itself is highly predictive of price index! From here, I added the price of fast food, the price of a monthly bus pass, and the region in which the city was located as my final model.
Here are the results of my final model:
Here’s an example of the model in action. I’ll calculate the price indices for Chicago and compare it to South Bend.
My model calculates that Chicago’s cost of living is about 69% more expensive than South Bend’s.
The code for the project can be found on my GitHub.
Here’s a link to some visualizations that I made for this project.


rotten
>
Library
>
History
>
Index by Country
> Russia
Russia
Rasputin
Ivan The Terrible
Russia is an
atomic power
.
Invaded by
Napoleon
Invaded by
Adolf Hitler
KGB and the rise of the
Oligarchs
Andrei Chikatilo
Ayn Rand
Saint Petersburg
Pornopolis
|
Rotten
|
Faces of Death
|
Famous Nudes


My nutmeg experience began innocently enough. i had heard from a friend that nutmeg gets you slightly high. i didnt have access to any good weed back then. dint really know anyone who would have any, so nutmeg seemed like the best option. it was simply lyin in a jar in the kitchen!!
So one sunday night, listenin to floyd, i decided to take them. why? good question. to get high! there are so many reasons. but firstly it wasnt peer pressure, i was doing this alone. was it to escape from problems you ask? well, i dont think so. i didnt have any serious problems back then. i was good at school. had some good friends. life was good. so then why? well, simply to get high. to leave everything behind. music was one of the main attributes as well. i get very high on music.
anyway, i first took two entire nutmegs. i had no idea how to take them. i hadnt read this site back then. i thought that the nutmeg would be very hard. that i would have to crush them befroe i could swallow them. but to my surprise, it broke quite easily as soon as i bit into it. so i chewed them as quickly as possible and then drank a lot of water. the taste wasn't great but it wasnt as bad as some ppl have made it to seem. all this happened very late night.. at about 2.30 am.
i waited a bit. turned down the lights, turned up the music. at first it seemed that the music was gettin louder.. but that was just wishful thinking. nothing seemed to be happening!!! i waited for about half an hour. but no reaction what so ever! so i swallowed another entire nutmeg. chewed it as fast as humanly possible and swallowed it. it was 3 am. nothing seemed to be happening. i waited another 10 minutes or so. then getting tired of the entire ordeal, i decided it to call it night. i was pretty cheezed.. cos i didnt feel anything whatsoever!!! so i simply went to sleep.
the next morning i had to get up early for school. i got up at 6.15. this was about 4 hours after i took the nutmeg. the first thing i noticed were that my lips were extremely dry..actually my entire mouth was. but other wise i felt completely sane. so i drank a lot of water, got dressed, and went to school.
i had an important test in the morning starting from eight o'clock. i hadn't studied the previous night for obvious reasons. so i tried to read as much of the text i could on the bus. but i had difficulty paying attention. not that i was high or anything, but my mouth was extremely dry.. and things seemed to be slowing down. that was the first time i thought something was happening.
i reached school at about 7.35. by this time i was talking very slowly for some reason. some friends also commented that i was acting weirdly. My friend, A, told me 'I hope B did the project, and brings it today.' my reaction - 'yeah, or we'll screw her happiness FOREVERRR!!!' i am a very docile person and such a violent reaction kinda startled my friend.
this was a few minutes before eight, when the test was to begin. i sat down and began the test, acutely aware of something strange happening within me. half way through the test.. it hit me. this must have been at about 8.30. i could not write straight.. i cud not think straight. my mind seemed to have left me. and my mouth was unbearably dry.
once the test was over, i went in a corner and sat. i was definately sure that the nutmeg was finally working. this was about 6 and a half hours after ingesting it. what i felt at this point is hard to explain. it seemed i had almost left myself. i am not saying this spiritually or anything. whenever people said anythign directed towards me.. it felt as if they were talking to someone else. i felt deattatched.. almost a third person.. the omniscient observer. and my responses seemed much slower. i was drawling. and at the same time i found things funny.. not the giggly kind of funny.. but somehow humorous.
my friends noticed something wrong in me by this time. my eyes were bloodshot, my face was pale.. and of course the mouth was completely dry.
a few friends were like.. 'maryyy wat did you take? gimme some!!'
and i just stared at them dumbly, with a smirk on my face.
this was at 9.30 or so.. precisely 7 hours after i took the nutmeg. for some reason, we had no class then. there was no teacher n only a few kids in class. so i just occupied a seat in one corner and watched the world go by.
i managed to get a bottle of water from somewhere. here is where the trippy part of my experience began. i was simply sitting in my corner seat.. sipping my water.. looking down.. when i happened to look inside the plastic bottle. the light from outside and the water produced an interesting pattern. by shaking the bottle slightly, i cud get the pattern to move and the colours to change. soon i became hypnotised by the bottle.
for the next two hours, i sat in the same corner seat, peering into the bottle, without moving an inch. my friends thought i had gone insane, but i was in another world.
the pattern created through the different colours and the water merged and sent me on a wild trip. at first it seemed as though i was moving forward.. first gradually.. and then faster and faster. it was almost as if i was in space. everything was either black, purple, grey or white. i was moving faster and faster and there was this giant grey planet kind of thing.. with barbs sticking out of it (i later realised that i saw this because the bottom of the bottle had a circular barb-like shape in the centre.. ) anyway, there these white star like things streaking through the sky. i was moving very fast now.. and there were many of those grey planets.
i got distracted at this point because somebody came n asked me how i was feeling. i said i was fine and continued the trip. this time everything had completely changed. except for the fact that everything was still black, white, grey n purple. this time i was moving very fast down a roadlike thing. the sky was black, the road was greyish. there was purple eveyhere.. purple bushes, trees, mountainside. it was one of those curvy mountainy roads.. that kept on bending. i was moving at incredible speeds. then this black n purple train also came. i saw it speeding down the same path. i had to stop it from falling .. or hitting the mountain side. it was almost frightening.
it was past 11 by now. 8 and a half hours since the moment of ingestion. at 11.20.. our lunch time.. a friend of mine approached me and broke my silent reveries. she had been away from class, practicing for some dance competition. she had no idea wat condition i was in. when they she heard that i was acting strangely she came rushing to my side. she dragged me out of class.
i staggered behind her, clutching my bottle of water. i could barely walk straight. she made me sit on the floor while she interrogated me. she found out exactly what i had taken and when. my answers were very slow and drawl-like. i had this huge smirk on my face the entire time.
she took me to the bathroom mirror.. to see myself. i have to admit i did not look very good. eyes blood shot, face pale - colourless, lips unrecognisably dry. she then dragged me to the medical room, and told me to go to sleep.
i obeyed.. for like 20 minutes. i wasnt feeling sleepy (as yet!!). so i managed to sneak out of the medical room and went to the abandoned music room. i found a guitar.. which kept me occupied for quite a while. but then i got bored of that so i decided to go back to class. i heard comments like 'hey woman.. you stoned??' on my way back. it must have been around 12.30 - 1.00pm. there was a lecture happening in my class. i waited for the teacher to leave and then attended the last class. atleast i tried to. it was at this time that sleep struck! and i swear.. when nutmeg induced sleep struck.. I had to sleep!!!
so i slept through the last class and then it was time to go home. on the bus ride i was totally spaced out.. but i dont think anyone noticed. so somehow.. i dont have very much recollection of this part.. i managed to reach home. this must have been around 3pm.. exactly 12 and a half hours after taking the nutmeg.
there is only one thing i did after this.. SLEEP!!! i slept straight throught the afternoon, into the evening and night.. and would have continued sleeping through the next morning had my mother not woken me. in a half dead state the next mornign (6.15 am) i managed to get dressed and get into the bus. where i slept. then i went to class.. and i slept! i then spent the entire day in the medical room.. yep, you guessed it.. sleeping!! before i knew it.. i was at home.. sleeping!! i slept into the night. waking for dinner, and then goin back to sleep. the next day i decided not to go to school. i finally awoke at lunch time (1.30pm). i slept almost continiously for 45 hours!!!!
but i have to admit it was the best, most refreshing sleep i've ever had.
so there you have.. my nutmeg experience in a nutshell!!!
so here are a few things that i have realised in hindsight. i had not done any research about nutmeg, which i must admit was very foolish on my part. i now know that a nutmeg overdose can be fatal. i had no idea about that then.
as you can see, this experience with side effects lasted for about three days. that is extremely long. i missed a hell of a lot of school. so anyone who wants to try nutmeg should really plan in advance. also, my mom thought i was sick when i slept for two days. so she dragged me to the doctor for a blood test. so make sure your paranoid parents aren't around if your doing this. it was very obvious that I had taken something when on nutmeg. its not something I could hide easily. so again.. not good with paranoid parents.
also for some reason, nutmeg sucks the water out of me. it left me dry as a bone.. way more than weed or hash has ever done to me.
now i have to admit.. this was the best trip i've ever had. i havent done any other hallucinogens but i dont think it could have gotten better than this.
i havent ever done it again. not because i haven't wanted to. i have.. but i have been waiting for the right time. i know its not good for your liver n all.. but how bad can something be if you have it once a year??
lastly .. its LEGAL!! not that it matters here..
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Christina Muenzner
Preliminary Site Map — Version 1.0
Cart
Home
About
Gallery
Shop
Exhibitions
Blog
Contact


Echo UI Build Kit
02/2018: Report Modals
Eightbit Staging links: Reporting & Tracking Overlays
02/2018: Report Modals
Canceled Loads
Reporting & Tracking Overlays
Load Management
Dashboard
Account Management
Generic Shell Layouts
Links for Eight Bit Staging Site


 One of the things that made is particularly hard for me was deciding between Cornell and my other top choices was Cornell’s “Free agent system”. Here is a short post about what the system is and why it worked for me.
How do grad schools work?
For most schools in the US, when you apply to a PhD program, you are usually picked out by one or more professors who think you’d be a good fit. After visiting the school, the student decides which professor they want to work with and commit to the school. When the student starts at the school, they are funded by the professor and they start doing great things together. However, some schools don’t follow this system.
Cornell’s Free Agent System
At Cornell, and a few other schools, the admission process looks a bit different. When a PhD student is admitted to Cornell, they are are admitted to the department, which highlights Cornell’s commitment towards the student’s academic freedom. Concretely, this means that Cornell guarantees funding, usually through teaching assistantship, for the student without tying them to an advisor 1. . This is supposed to allow the students to explore and talk to potential advisors without being worried about funding. This is the Free Agent system at Cornell. Students are free agents till they decide who they want to work with
The Problem
Cornell’s free agent system was devised when the department was young and the incoming PhD students tended to have comparatively less research experience. The free agent system allowed students to explore different areas without being pressured into working on topics they might disliked. However, in the recent years, the makeup of people applying to PhD programs has drastically changed — students tend to come in with a lot more research experience and are usually quite certain about the area they want to work in.
Furthermore, the CS department is also structured in a way that assumes
students are free agents their first year. This means that they are expected to
take a lot of classes and 2 be teaching assistants (TAs) in their first
two semesters.
My Experience
The free agent system was the biggest reason that caused me to delay my decision. For some background, I started doing programming languages (PL) research in the first semester of my undergraduate degree and was certain about the kind of research I wanted to pursue in grad school. Furthermore, I knew that Cornell was the best fit for my interest in doing PL work at the intersection of other fields.
Unfortunately, I was also afraid of not being able to find an advisor and wanted to choose a school where I knew I had an advisor. After about 6 hours of post visit-day talks with professors and students in the PL group, I decided to go to Cornell. Even after my acceptance, I wasn’t sure if I’d be able to find an advisor.
When I started in Fall, I emailed several professors in the PL group and setup meetings. This is where I found the true strength of the free agent system. Since professors expect students to go talk to a lot of people, they expect and often encourage students to do research rotations with professors they are interested in working with. It also makes it easy to reach out to professors and learn about their work. I cannot understate how important it is to me to learn about and have conversations about research in different domains. One of my goals going into a PhD is to have a broad sense of the different kinds of problems in different domains and having access to professors in different areas makes it very easy to do so.
I was also able to start working with my awesome advisor Adrian Sampson and we quickly found a project I’m passionate about.
Caveat Emptor
While the free agent system caused me some anguish in the decision process, it was not the primary reason I decided join Cornell.
- Research that excited me, and people 3 who are just as excited about it as me were my primary motivators.
- The first year TA problem is non-trivial and causes some amount of stress for new grad students. However, the department is aware of the issues and is trying to move away from this system.
Finally, here is a more detailed post from Jean Yang on what considerations matter when deciding on schools. Good luck!
Have comments? Email me or tweet at me.
- Being tied to an advisor is not always a bad thing. In fact, most people decide on an advisor and not a school. ↩
- The CS department recently overhauled the course requirement to drastically reduce the number of classes and restrictions on which classes to take. ↩
- Importantly, This includes other grad students. Remember, you’re going to be spending a lot more time with other grad students than you will with faculty. ↩


What is the Lens Barrel Factor?
It is defined to fix the barrel factor which is caused by a DLP projector lens.
What is/are the reason(s) to use it?
By modifying the number, you can fix the lens distortion.
You can find more about the lens
distortion here.


|
Tuesday
|
The vec
class template and its associated utility structs and functions.
Classes | |
| struct | tue::is_vec_component< T > |
Checks if a type can be used as the component type of a vec . More... | |
| class | tue::vec< T, N > |
An N -dimensional vector. More... | |
Typedefs | |
| template<typename T > | |
| using | tue::vec2 = vec< T, 2 > |
| A 2-dimensional vector. More... | |
| template<typename T > | |
| using | tue::vec3 = vec< T, 3 > |
| A 3-dimensional vector. More... | |
| template<typename T > | |
| using | tue::vec4 = vec< T, 4 > |
| A 4-dimensional vector. More... | |
| using | tue::fvec2 = vec2< float > |
A 2-dimensional vector with float components. More... | |
| using | tue::fvec3 = vec3< float > |
A 3-dimensional vector with float components. More... | |
| using | tue::fvec4 = vec4< float > |
A 4-dimensional vector with float components. More... | |
| using | tue::dvec2 = vec2< double > |
A 2-dimensional vector with double components. More... | |
| using | tue::dvec3 = vec3< double > |
A 3-dimensional vector with double components. More... | |
| using | tue::dvec4 = vec4< double > |
A 4-dimensional vector with double components. More... | |
| using | tue::ivec2 = vec2< int > |
A 2-dimensional vector with int components. More... | |
| using | tue::ivec3 = vec3< int > |
A 3-dimensional vector with int components. More... | |
| using | tue::ivec4 = vec4< int > |
A 4-dimensional vector with int components. More... | |
| using | tue::uvec2 = vec2< unsigned int > |
A 2-dimensional vector with unsigned int components. More... | |
| using | tue::uvec3 = vec3< unsigned int > |
A 3-dimensional vector with unsigned int components. More... | |
| using | tue::uvec4 = vec4< unsigned int > |
A 4-dimensional vector with unsigned int components. More... | |
Functions | |
| template<typename T , int N> | |
| constexpr vec< decltype(+std::declval< T >)), N > | tue::operator+ (const vec< T, N > &v) noexcept |
Computes the unary plus of each component of v . More... | |
| template<typename T , int N> | |
| constexpr vec< decltype(-std::declval< T >)), N > | tue::operator- (const vec< T, N > &v) noexcept |
Computes the unary minus of each component of v . More... | |
| template<typename T , int N> | |
| constexpr vec< decltype(~std::declval< T >)), N > | tue::operator~ (const vec< T, N > &v) noexcept |
Computes the bitwise NOT of each component of v . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >)+std::declval< U >)), N > > | tue::operator+ (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the sums of lhs and each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >)+std::declval< U >)), N > > | tue::operator+ (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the sums of each component of lhs and rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >)+std::declval< U >)), N > | tue::operator+ (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the sums of each component of lhs and each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >)-std::declval< U >)), N > > | tue::operator- (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the differences between lhs and each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >)-std::declval< U >)), N > > | tue::operator- (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the differences between each component of lhs and rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >)-std::declval< U >)), N > | tue::operator- (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the differences between each component of lhs and each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >)*std::declval< U >)), N > > | tue::operator* (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the products of lhs and each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >)*std::declval< U >)), N > > | tue::operator* (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the products of each component of lhs and rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >)*std::declval< U >)), N > | tue::operator* (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the products of each component of lhs and each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >)/std::declval< U >)), N > > | tue::operator/ (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the quotients of lhs over each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >)/std::declval< U >)), N > > | tue::operator/ (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the quotients of each component of lhs over rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >)/std::declval< U >)), N > | tue::operator/ (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the quotients of each component of lhs over each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >)%std::declval< U >)), N > > | tue::operator% (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the modulos of lhs over each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >)%std::declval< U >)), N > > | tue::operator% (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the modulos of each component of lhs over rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >)%std::declval< U >)), N > | tue::operator% (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the modulos of each component of lhs over each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >)&std::declval< U >)), N > > | tue::operator& (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise AND of lhs and each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >)&std::declval< U >)), N > > | tue::operator& (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the bitwise AND of each component of lhs and rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >)&std::declval< U >)), N > | tue::operator& (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise AND of each component of lhs and each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >)|std::declval< U >)), N > > | tue::operator| (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise OR of lhs and each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >)|std::declval< U >)), N > > | tue::operator| (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the bitwise OR of each component of lhs and rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >)|std::declval< U >)), N > | tue::operator| (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise OR of each component of lhs and each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >)^std::declval< U >)), N > > | tue::operator^ (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise XOR of lhs and each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >)^std::declval< U >)), N > > | tue::operator^ (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the bitwise XOR of each component of lhs and rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >)^std::declval< U >)), N > | tue::operator^ (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise XOR of each component of lhs and each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >) shift_left std::declval< U >)), N > > | tue::operator<< (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise shifts left of lhs by each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >) shift_left std::declval< U >)), N > > | tue::operator<< (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the bitwise shifts left of each component of lhs by rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >) shift_left std::declval< U >)), N > | tue::operator<< (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise shifts left of each component of lhs by each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< T >::value, vec< decltype(std::declval< T >) shift_right std::declval< U >)), N > > | tue::operator>> (const T &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise shifts right of lhs by each component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr std::enable_if_t< is_vec_component< U >::value, vec< decltype(std::declval< T >) shift_right std::declval< U >)), N > > | tue::operator>> (const vec< T, N > &lhs, const U &rhs) noexcept |
Computes the bitwise shifts right of each component of lhs by rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr vec< decltype(std::declval< T >) shift_right std::declval< U >)), N > | tue::operator>> (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the bitwise shifts right of each component of lhs by each corresponding component of rhs . More... | |
| template<typename T , typename U , int N> | |
| constexpr bool | tue::operator== (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Determines whether or not two vec 's compare equal. More... | |
| template<typename T , typename U , int N> | |
| constexpr bool | tue::operator!= (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Determines whether or not two vec 's compare not equal. More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::sin (const vec< T, N > &v) noexcept |
Computes tue::math::sin() for each component of v . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::cos (const vec< T, N > &v) noexcept |
Computes tue::math::cos() for each component of v . More... | |
| template<typename T , int N> | |
| void | tue::math::sincos (const vec< T, N > &v, vec< T, N > &sin_out, vec< T, N > &cos_out) noexcept |
Computes tue::math::sincos() for each component of v . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::exp (const vec< T, N > &v) noexcept |
Computes tue::math::exp() for each component of v . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::log (const vec< T, N > &v) noexcept |
Computes tue::math::log() for each component of v . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::abs (const vec< T, N > &v) noexcept |
Computes tue::math::abs() for each component of v . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::pow (const vec< T, N > &bases, const vec< T, N > &exponents) noexcept |
Computes tue::math::pow() for each component of bases and each corresponding component of exponents . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::recip (const vec< T, N > &v) noexcept |
Computes tue::math::recip() for each component of v . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::sqrt (const vec< T, N > &v) noexcept |
Computes tue::math::sqrt() for each component of v . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::rsqrt (const vec< T, N > &v) noexcept |
Computes tue::math::rsqrt() for each component of v . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::min (const vec< T, N > &v1, const vec< T, N > &v2) noexcept |
Computes tue::math::min() for each corresponding pair of components from v1 and v2 . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::max (const vec< T, N > &v1, const vec< T, N > &v2) noexcept |
Computes tue::math::max() for each corresponding pair of components from v1 and v2 . More... | |
| template<typename T , typename U , int N> | |
| vec< U, N > | tue::math::mask (const vec< T, N > &conditions, const vec< U, N > &values) noexcept |
Computes tue::math::mask() for each corresponding pair of components from conditions and values . More... | |
| template<typename T , typename U , int N> | |
| vec< U, N > | tue::math::select (const vec< T, N > &conditions, const vec< U, N > &values, const vec< U, N > &otherwise) noexcept |
Computes tue::math::select() for each corresponding trio of components from conditions , values , and otherwise . More... | |
| template<typename T , int N> | |
| vec< decltype(tue::math::less(std::declval< T >), std::declval< T >))), N > | tue::math::less (const vec< T, N > &lhs, const vec< T, N > &rhs) noexcept |
Computes tue::math::less() for each corresponding pair of components from lhs and rhs . More... | |
| template<typename T , int N> | |
| vec< decltype(tue::math::less_equal(std::declval< T >), std::declval< T >))), N > | tue::math::less_equal (const vec< T, N > &lhs, const vec< T, N > &rhs) noexcept |
Computes tue::math::less_equal() for each corresponding pair of components from lhs and rhs . More... | |
| template<typename T , int N> | |
| vec< decltype(tue::math::greater(std::declval< T >), std::declval< T >))), N > | tue::math::greater (const vec< T, N > &lhs, const vec< T, N > &rhs) noexcept |
Computes tue::math::greater() for each corresponding pair of components from lhs and rhs . More... | |
| template<typename T , int N> | |
| vec< decltype(tue::math::greater_equal(std::declval< T >), std::declval< T >))), N > | tue::math::greater_equal (const vec< T, N > &lhs, const vec< T, N > &rhs) noexcept |
Computes tue::math::greater_equal() for each corresponding pair of components from lhs and rhs . More... | |
| template<typename T , int N> | |
| vec< decltype(tue::math::equal(std::declval< T >), std::declval< T >))), N > | tue::math::equal (const vec< T, N > &lhs, const vec< T, N > &rhs) noexcept |
Computes tue::math::equal() for each corresponding pair of components from lhs and rhs . More... | |
| template<typename T , int N> | |
| vec< decltype(tue::math::not_equal(std::declval< T >), std::declval< T >))), N > | tue::math::not_equal (const vec< T, N > &lhs, const vec< T, N > &rhs) noexcept |
Computes tue::math::not_equal() for each corresponding pair of components from lhs and rhs . More... | |
| template<typename T , typename U , int N> | |
| decltype(std::declval< T >()*std::declval< U >()) constexpr | tue::math::dot (const vec< T, N > &lhs, const vec< U, N > &rhs) noexcept |
Computes the dot product of lhs and rhs . More... | |
| template<typename T , typename U > | |
| constexpr vec3< decltype(std::declval< T >)*std::declval< U >))> | tue::math::cross (const vec3< T > &lhs, const vec3< U > &rhs) noexcept |
Computes the cross product of lhs and rhs . More... | |
| template<typename T , int N> | |
| T | tue::math::length (const vec< T, N > &v) noexcept |
Computes the vector length of v . More... | |
| template<typename T , int N> | |
| constexpr T | tue::math::length2 (const vec< T, N > &v) noexcept |
Computes the vector length squared of v . More... | |
| template<typename T , int N> | |
| T | tue::math::rlength (const vec< T, N > &v) noexcept |
Computes the reciprocal of the vector length of v . More... | |
| template<typename T , int N> | |
| vec< T, N > | tue::math::normalize (const vec< T, N > &v) noexcept |
Computes a normalized copy of v . More... | |
| struct tue::is_vec_component |
Checks if a type can be used as the component type of a vec
.
Extends std::integral_constant<bool, true>
for the following types and std::integral_constant<bool, false>
otherwise:
float
double
std::int8_t
std::int16_t
std::int32_t
std::int64_t
std::uint8_t
std::uint16_t
std::uint32_t
std::uint64_t
tue::bool8
tue::bool16
tue::bool32
tue::bool64
tue::simd
| T | The type to check. |
| class tue::vec |
An N
-dimensional vector.
vec
has the same size and alignment requirements as T[N]
.
| T | The component type. is_vec_component<T>value must be true . |
| N | The component count. Must be 2 , 3 , or 4 . |
Public Types | |
| using | component_type = T |
This vec type's component type. More... | |
Static Public Attributes | |
| static constexpr int | component_count = N |
This vec type's component count. More... | |
Constructors, Conversions, and Factory Functions | |
| vec () noexcept=default | |
| Default constructs each component. More... | |
| constexpr | vec (const T &x) noexcept |
| Constructs each component with the same value. More... | |
| constexpr | vec (const T &x, const T &y) noexcept |
| Constructs each component with the value of the corresponding argument. More... | |
| constexpr | vec (const T &x, const T &y, const T &z) noexcept |
| Constructs each component with the value of the corresponding argument. More... | |
| constexpr | vec (const T &x, const T &y, const T &z, const T &w) noexcept |
| Constructs each component with the value of the corresponding argument. More... | |
| constexpr | vec (const vec2< T > &xy, const T &z) noexcept |
| Constructs each component with the value of the corresponding argument. More... | |
| constexpr | vec (const vec2< T > &xy, const T &z, const T &w) noexcept |
| Constructs each component with the value of the corresponding argument. More... | |
| constexpr | vec (const vec3< T > &xyz, const T &w) noexcept |
| Constructs each component with the value of the corresponding argument. More... | |
| template<int VN, typename = std::enable_if_t<(VN greater_than N)>> | |
| constexpr | vec (const vec< T, VN > &v) noexcept |
Truncates a larger vec with the same component type. More... | |
| template<typename U > | |
| constexpr | vec (const vec< U, N > &v) noexcept |
Explicitly casts another vec to a new component type. More... | |
| template<typename U > | |
| constexpr | operator vec< U, N > () const noexcept |
Implicitly casts this vec to a new component type. More... | |
| static constexpr vec< T, N > | zero () noexcept |
Returns a vec with each component set to 0 . More... | |
| static constexpr vec< T, N > | x_axis () noexcept |
Returns a vec with the first component set to 1 and all other components set to 0 . More... | |
| static constexpr vec< T, N > | y_axis () noexcept |
Returns a vec with the second component set to 1 and all other components set to 0 . More... | |
| static constexpr vec< T, N > | z_axis () noexcept |
Returns a vec with the third component set to 1 and all other components set to 0 . More... | |
| static constexpr vec< T, N > | w_axis () noexcept |
Returns a vec with the fourth component set to 1 and all other components set to 0 . More... | |
Public Member Functions | |
| template<typename I > | |
| constexpr const T & | operator[] (const I &i) const noexcept |
| Returns a reference to the component at the given index. More... | |
| template<typename I > | |
| T & | operator[] (const I &i) noexcept |
| Returns a reference to the component at the given index. More... | |
| const T * | data () const noexcept |
Returns a pointer to this vec 's underlying component array. More... | |
| T * | data () noexcept |
Returns a pointer to this vec 's underlying component array. More... | |
| constexpr T | x () const noexcept |
Returns a copy of this vec 's first component. More... | |
| constexpr T | y () const noexcept |
Returns a copy of this vec 's second component. More... | |
| constexpr T | z () const noexcept |
Returns a copy of this vec 's third component. More... | |
| constexpr T | w () const noexcept |
Returns a copy of this vec 's fourth component. More... | |
| constexpr vec2< T > | xy () const noexcept |
Returns a copy of this vec 's first two components. More... | |
| constexpr vec3< T > | xyz () const noexcept |
Returns a copy of this vec 's first three components. More... | |
| constexpr vec4< T > | xyzw () const noexcept |
Returns a copy of this vec 's first four components. More... | |
| void | set_x (const T &x) noexcept |
Sets this vec 's first component. More... | |
| void | set_y (const T &y) noexcept |
Sets this vec 's second component. More... | |
| void | set_z (const T &z) noexcept |
Sets this vec 's third component. More... | |
| void | set_w (const T &w) noexcept |
Sets this vec 's fourth component. More... | |
| void | set_xy (const T &x, const T &y) noexcept |
Sets this vec 's first two components. More... | |
| void | set_xy (const vec2< T > &xy) noexcept |
Sets this vec 's first two components. More... | |
| void | set_xyz (const T &x, const T &y, const T &z) noexcept |
Sets this vec 's first three components. More... | |
| void | set_xyz (const vec2< T > &xy, const T &z) noexcept |
Sets this vec 's first three components. More... | |
| void | set_xyz (const vec3< T > &xyz) noexcept |
Sets this vec 's first three components. More... | |
| void | set_xyzw (const T &x, const T &y, const T &z, const T &w) noexcept |
Sets this vec 's first four components. More... | |
| void | set_xyzw (const vec2< T > &xy, const T &z, const T &w) noexcept |
Sets this vec 's first four components. More... | |
| void | set_xyzw (const vec3< T > &xyz, const T &w) noexcept |
Sets this vec 's first four components. More... | |
| void | set_xyzw (const vec4< T > &xyzw) noexcept |
Sets this vec 's first four components. More... | |
| constexpr T | r () const noexcept |
Returns a copy of this vec 's first component. More... | |
| constexpr T | g () const noexcept |
Returns a copy of this vec 's second component. More... | |
| constexpr T | b () const noexcept |
Returns a copy of this vec 's third component. More... | |
| constexpr T | a () const noexcept |
Returns a copy of this vec 's fourth component. More... | |
| constexpr vec2< T > | rg () const noexcept |
Returns a copy of this vec 's first two components. More... | |
| constexpr vec3< T > | rgb () const noexcept |
Returns a copy of this vec 's first three components. More... | |
| constexpr vec4< T > | rgba () const noexcept |
Returns a copy of this vec 's first four components. More... | |
| void | set_r (const T &r) noexcept |
Sets this vec 's first component. More... | |
| void | set_g (const T &g) noexcept |
Sets this vec 's second component. More... | |
| void | set_b (const T &b) noexcept |
Sets this vec 's third component. More... | |
| void | set_a (const T &a) noexcept |
Sets this vec 's fourth component. More... | |
| void | set_rg (const T &r, const T &g) noexcept |
Sets this vec 's first two components. More... | |
| void | set_rg (const vec2< T > &rg) noexcept |
Sets this vec 's first two components. More... | |
| void | set_rgb (const T &r, const T &g, const T &b) noexcept |
Sets this vec 's first three components. More... | |
| void | set_rgb (const vec2< T > &rg, const T &b) noexcept |
Sets this vec 's first three components. More... | |
| void | set_rgb (const vec3< T > &rgb) noexcept |
Sets this vec 's first three components. More... | |
| void | set_rgba (const T &r, const T &g, const T &b, const T &a) noexcept |
Sets this vec 's first four components. More... | |
| void | set_rgba (const vec2< T > &rg, const T &b, const T &a) noexcept |
Sets this vec 's first four components. More... | |
| void | set_rgba (const vec3< T > &rgb, const T &a) noexcept |
Sets this vec 's first four components. More... | |
| void | set_rgba (const vec4< T > &rgba) noexcept |
Sets this vec 's first four components. More... | |
| vec< T, N > & | operator++ () noexcept |
Pre-increments each component of this vec . More... | |
| vec< T, N > | operator++ (int) noexcept |
Post-increments each component of this vec . More... | |
| vec< T, N > & | operator-- () noexcept |
Pre-decrements each component of this vec . More... | |
| vec< T, N > | operator-- (int) noexcept |
Post-decrements each component of this vec . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator+= (const U &x) noexcept |
Adds x to each component of this vec . More... | |
| template<typename U > | |
| vec< T, N > & | operator+= (const vec< U, N > &v) noexcept |
Adds each component of v to the corresponding component of this vec . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator-= (const U &x) noexcept |
Subtracts x from each component of this vec . More... | |
| template<typename U > | |
| vec< T, N > & | operator-= (const vec< U, N > &v) noexcept |
Subtracts each component of v from the corresponding component of this vec . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator*= (const U &x) noexcept |
Multiplies each component of this vec by x . More... | |
| template<typename U > | |
| vec< T, N > & | operator*= (const vec< U, N > &v) noexcept |
Multiplies each component of this vec by the corresponding component from v . More... | |
| template<typename U > | |
| vec< T, N > & | operator*= (const quat< U > &q) noexcept |
Rotates this vec by q . More... | |
| template<typename U > | |
| vec< T, N > & | operator*= (const mat< U, N, N > &m) noexcept |
Matrix multiplies this vec by m . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator/= (const U &x) noexcept |
Divides each component of this vec by x . More... | |
| template<typename U > | |
| vec< T, N > & | operator/= (const vec< U, N > &v) noexcept |
Divides each component of this vec by the corresponding component from v . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator%= (const U &x) noexcept |
Modulos each component of this vec by x . More... | |
| template<typename U > | |
| vec< T, N > & | operator%= (const vec< U, N > &v) noexcept |
Modulos each component of this vec by the corresponding component from v . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator&= (const U &x) noexcept |
Bitwise ANDs each component of this vec with x . More... | |
| template<typename U > | |
| vec< T, N > & | operator&= (const vec< U, N > &v) noexcept |
Bitwise ANDs each component of this vec with the corresponding component from v . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator|= (const U &x) noexcept |
Bitwise ORs each component of this vec with x . More... | |
| template<typename U > | |
| vec< T, N > & | operator|= (const vec< U, N > &v) noexcept |
Bitwise ORs each component of this vec with the corresponding component from v . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator^= (const U &x) noexcept |
Bitwise XORs each component of this vec with x . More... | |
| template<typename U > | |
| vec< T, N > & | operator^= (const vec< U, N > &v) noexcept |
Bitwise XORs each component of this vec with the corresponding component from v . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator<<= (const U &x) noexcept |
Bitwise shifts left each component of this vec by x . More... | |
| template<typename U > | |
| vec< T, N > & | operator<<= (const vec< U, N > &v) noexcept |
Bitwise shifts left each component of this vec by the corresponding component from v . More... | |
| template<typename U > | |
| std::enable_if_t< is_vec_component< U >::value, vec< T, N > & > | operator>>= (const U &x) noexcept |
Bitwise shifts right each component of this vec by x . More... | |
| template<typename U > | |
| vec< T, N > & | operator>>= (const vec< U, N > &v) noexcept |
Bitwise shifts right each component of this vec by the corresponding component from v . More... | |
| using tue::vec< T, N >::component_type = T |
This vec
type's component type.
|
static |
This vec
type's component count.
Default constructs each component.
Constructs each component with the same value.
| x | The value to construct each component with. |
|
inlinenoexcept |
Constructs each component with the value of the corresponding argument.
This overload is only available when N
equals 2
.
| x | The value to construct the first component with. |
| y | The value to construct the second component with. |
|
inlinenoexcept |
Constructs each component with the value of the corresponding argument.
This overload is only available when N
equals 3
.
| x | The value to construct the first component with. |
| y | The value to construct the second component with. |
| z | The value to construct the third component with. |
|
inlinenoexcept |
Constructs each component with the value of the corresponding argument.
This overload is only available when N
equals 4
.
| x | The value to construct the first component with. |
| y | The value to construct the second component with. |
| z | The value to construct the third component with. |
| w | The value to construct the fourth component with. |
|
inlinenoexcept |
Constructs each component with the value of the corresponding argument.
This overload is only available when N
equals 3
.
| xy | The values to construct the first two components with. |
| z | The value to construct the third component with. |
|
inlinenoexcept |
Constructs each component with the value of the corresponding argument.
This overload is only available when N
equals 4
.
| xy | The values to construct the first two components with. |
| z | The value to construct the third component with. |
| w | The value to construct the fourth component with. |
|
inlinenoexcept |
Constructs each component with the value of the corresponding argument.
This overload is only available when N
equals 4
.
| xyz | The values to construct the first three components with. |
| w | The value to construct the fourth component with. |
|
inlineexplicitnoexcept |
Truncates a larger vec
with the same component type.
| VN | The component count of v . |
| v | The larger vec to truncate. |
|
inlineexplicitnoexcept |
Explicitly casts another vec
to a new component type.
| U | The component type of v . |
| v | The vec to cast from. |
|
inlinenoexcept |
Implicitly casts this vec
to a new component type.
| U | The new component type. |
vec
with the new component type.
|
inlinestaticnoexcept |
Returns a vec
with each component set to 0
.
vec
with each component set to 0
.
|
inlinestaticnoexcept |
Returns a vec
with the first component set to 1
and all other components set to 0
.
vec
with the first component set to 1
and all other components set to 0
.
|
inlinestaticnoexcept |
Returns a vec
with the second component set to 1
and all other components set to 0
.
vec
with the second component set to 1
and all other components set to 0
.
|
inlinestaticnoexcept |
Returns a vec
with the third component set to 1
and all other components set to 0
.
This overload is only available when N
is greater than or equal to 3
.
vec
with the third component set to 1
and all other components set to 0
.
|
inlinestaticnoexcept |
Returns a vec
with the fourth component set to 1
and all other components set to 0
.
This overload is only available when N
is greater than or equal to 4
.
vec
with the fourth component set to 1
and all other components set to 0
.
|
inlinenoexcept |
Returns a reference to the component at the given index.
No bounds checking is performed.
| I | The index type. |
| i | The index. |
|
inlinenoexcept |
Returns a reference to the component at the given index.
No bounds checking is performed.
| I | The index type. |
| i | The index. |
|
inlinenoexcept |
Returns a pointer to this vec
's underlying component array.
vec
's underlying component array.
|
inlinenoexcept |
Returns a pointer to this vec
's underlying component array.
vec
's underlying component array.
|
inlinenoexcept |
Returns a copy of this vec
's first component.
vec
's first component.
|
inlinenoexcept |
Returns a copy of this vec
's second component.
vec
's second component.
|
inlinenoexcept |
Returns a copy of this vec
's third component.
This overload is only available when N
is greater than or equal to 3
.
vec
's third component.
|
inlinenoexcept |
Returns a copy of this vec
's fourth component.
This overload is only available when N
is greater than or equal to 4
.
vec
's fourth component. Returns a copy of this vec
's first two components.
vec
's first two components. Returns a copy of this vec
's first three components.
This overload is only available when N
is greater than or equal to 3
.
vec
's first three components. Returns a copy of this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
vec
's first four components.
|
inlinenoexcept |
Sets this vec
's first component.
| x | The new value for the first component. |
|
inlinenoexcept |
Sets this vec
's second component.
| y | The new value for the second component. |
|
inlinenoexcept |
Sets this vec
's third component.
This overload is only available when N
is greater than or equal to 3
.
| z | The new value for the third component. |
|
inlinenoexcept |
Sets this vec
's fourth component.
This overload is only available when N
is greater than or equal to 4
.
| w | The new value for the fourth component. |
|
inlinenoexcept |
Sets this vec
's first two components.
| x | The new value for the first component. |
| y | The new value for the second component. |
Sets this vec
's first two components.
| xy | The new values for the first two components. |
|
inlinenoexcept |
Sets this vec
's first three components.
This overload is only available when N
is greater than or equal to 3
.
| x | The new value for the first component. |
| y | The new value for the second component. |
| z | The new value for the third component. |
|
inlinenoexcept |
Sets this vec
's first three components.
This overload is only available when N
is greater than or equal to 3
.
| xy | The new values for the first two components. |
| z | The new value for the third component. |
Sets this vec
's first three components.
This overload is only available when N
is greater than or equal to 3
.
| xyz | The new values for the first three components. |
|
inlinenoexcept |
Sets this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
| x | The new value for the first component. |
| y | The new value for the second component. |
| z | The new value for the third component. |
| w | The new value for the fourth component. |
|
inlinenoexcept |
Sets this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
| xy | The new values for the first two components. |
| z | The new value for the third component. |
| w | The new value for the fourth component. |
|
inlinenoexcept |
Sets this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
| xyz | The new values for the first three components. |
| w | The new value for the fourth component. |
|
inlinenoexcept |
Sets this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
| xyzw | The new values for the first four components. |
|
inlinenoexcept |
Returns a copy of this vec
's first component.
vec
's first component.
|
inlinenoexcept |
Returns a copy of this vec
's second component.
vec
's second component.
|
inlinenoexcept |
Returns a copy of this vec
's third component.
This overload is only available when N
is greater than or equal to 3
.
vec
's third component.
|
inlinenoexcept |
Returns a copy of this vec
's fourth component.
This overload is only available when N
is greater than or equal to 4
.
vec
's fourth component. Returns a copy of this vec
's first two components.
vec
's first two components. Returns a copy of this vec
's first three components.
This overload is only available when N
is greater than or equal to 3
.
vec
's first three components. Returns a copy of this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
vec
's first four components.
|
inlinenoexcept |
Sets this vec
's first component.
| r | The new value for the first component. |
|
inlinenoexcept |
Sets this vec
's second component.
| g | The new value for the second component. |
|
inlinenoexcept |
Sets this vec
's third component.
This overload is only available when N
is greater than or equal to 3
.
| b | The new value for the third component. |
|
inlinenoexcept |
Sets this vec
's fourth component.
This overload is only available when N
is greater than or equal to 4
.
| a | The new value for the fourth component. |
|
inlinenoexcept |
Sets this vec
's first two components.
| r | The new value for the first component. |
| g | The new value for the second component. |
Sets this vec
's first two components.
| rg | The new values for the first two components. |
|
inlinenoexcept |
Sets this vec
's first three components.
This overload is only available when N
is greater than or equal to 3
.
| r | The new value for the first component. |
| g | The new value for the second component. |
| b | The new value for the third component. |
|
inlinenoexcept |
Sets this vec
's first three components.
This overload is only available when N
is greater than or equal to 3
.
| rg | The new values for the first two components. |
| b | The new value for the third component. |
Sets this vec
's first three components.
This overload is only available when N
is greater than or equal to 3
.
| rgb | The new values for the first three components. |
|
inlinenoexcept |
Sets this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
| r | The new value for the first component. |
| g | The new value for the second component. |
| b | The new value for the third component. |
| a | The new value for the fourth component. |
|
inlinenoexcept |
Sets this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
| rg | The new values for the first two components. |
| b | The new value for the third component. |
| a | The new value for the fourth component. |
|
inlinenoexcept |
Sets this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
| rgb | The new values for the first three components. |
| a | The new value for the fourth component. |
|
inlinenoexcept |
Sets this vec
's first four components.
This overload is only available when N
is greater than or equal to 4
.
| rgba | The new values for the first four components. |
Pre-increments each component of this vec
.
vec
. Post-increments each component of this vec
.
vec
before being incremented. Pre-decrements each component of this vec
.
vec
. Post-decrements each component of this vec
.
vec
before being decremented.
|
inlinenoexcept |
Adds x
to each component of this vec
.
| U | The type of parameter x . |
| x | The value to add to each component of this vec . |
vec
.
|
inlinenoexcept |
Adds each component of v
to the corresponding component of this vec
.
| U | The component type of v . |
| v | The values to add to each component of this vec . |
vec
.
|
inlinenoexcept |
Subtracts x
from each component of this vec
.
| U | The type of parameter x . |
| x | The value to subtract from each component of this vec . |
vec
.
|
inlinenoexcept |
Subtracts each component of v
from the corresponding component of this vec
.
| U | The component type of v . |
| v | The values to subtract from each component of this vec . |
vec
.
|
inlinenoexcept |
Multiplies each component of this vec
by x
.
| U | The type of parameter x . |
| x | The value to multiply each component of this vec by. |
vec
.
|
inlinenoexcept |
Multiplies each component of this vec
by the corresponding component from v
.
| U | The component type of v . |
| v | The values to multiply each component of this vec by. |
vec
.
|
inlinenoexcept |
Rotates this vec
by q
.
This overload is only available when N
is equal to 3
. The operand order might be the opposite of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.
| U | The component type of q . |
| q | A rotation quat . |
vec
.
|
inlinenoexcept |
Matrix multiplies this vec
by m
.
This vec
is treated as a matrix with a single row.
| U | The component type of m . |
| m | A mat . |
vec
.
|
inlinenoexcept |
Divides each component of this vec
by x
.
| U | The type of parameter x . |
| x | The value to divide each component of this vec by. |
vec
.
|
inlinenoexcept |
Divides each component of this vec
by the corresponding component from v
.
| U | The component type of v . |
| v | The values to divide each component of this vec by. |
vec
.
|
inlinenoexcept |
Modulos each component of this vec
by x
.
| U | The type of parameter x . |
| x | The value to modulo each component of this vec by. |
vec
.
|
inlinenoexcept |
Modulos each component of this vec
by the corresponding component from v
.
| U | The component type of v . |
| v | The values to modulo each component of this vec by. |
vec
.
|
inlinenoexcept |
Bitwise ANDs each component of this vec
with x
.
| U | The type of parameter x . |
| x | The value to bitwise AND each component of this vec with. |
vec
.
|
inlinenoexcept |
Bitwise ANDs each component of this vec
with the corresponding component from v
.
| U | The component type of v . |
| v | The values to bitwise AND each component of this vec with. |
vec
.
|
inlinenoexcept |
Bitwise ORs each component of this vec
with x
.
| U | The type of parameter x . |
| x | The value to bitwise OR each component of this vec with. |
vec
.
|
inlinenoexcept |
Bitwise ORs each component of this vec
with the corresponding component from v
.
| U | The component type of v . |
| v | The values to bitwise OR each component of this vec with. |
vec
.
|
inlinenoexcept |
Bitwise XORs each component of this vec
with x
.
| U | The type of parameter x . |
| x | The value to bitwise XOR each component of this vec with. |
vec
.
|
inlinenoexcept |
Bitwise XORs each component of this vec
with the corresponding component from v
.
| U | The component type of v . |
| v | The values to bitwise XOR each component of this vec with. |
vec
.
|
inlinenoexcept |
Bitwise shifts left each component of this vec
by x
.
| U | The type of parameter x . |
| x | The value to bitwise shift left each component of this vec by. |
vec
.
|
inlinenoexcept |
Bitwise shifts left each component of this vec
by the corresponding component from v
.
| U | The component type of v . |
| v | The values to bitwise shift left each component of this vec by. |
vec
.
|
inlinenoexcept |
Bitwise shifts right each component of this vec
by x
.
| U | The type of parameter x . |
| x | The value to bitwise shift right each component of this vec by. |
vec
.
|
inlinenoexcept |
Bitwise shifts right each component of this vec
by the corresponding component from v
.
| U | The component type of v . |
| v | The values to bitwise shift right each component of this vec by. |
vec
. | using tue::vec2 = typedef vec<T, 2> |
A 2-dimensional vector.
| T | The component type. |
| using tue::vec3 = typedef vec<T, 3> |
A 3-dimensional vector.
| T | The component type. |
| using tue::vec4 = typedef vec<T, 4> |
A 4-dimensional vector.
| T | The component type. |
| using tue::fvec2 = typedef vec2<float> |
A 2-dimensional vector with float
components.
| using tue::fvec3 = typedef vec3<float> |
A 3-dimensional vector with float
components.
| using tue::fvec4 = typedef vec4<float> |
A 4-dimensional vector with float
components.
| using tue::dvec2 = typedef vec2<double> |
A 2-dimensional vector with double
components.
| using tue::dvec3 = typedef vec3<double> |
A 3-dimensional vector with double
components.
| using tue::dvec4 = typedef vec4<double> |
A 4-dimensional vector with double
components.
| using tue::ivec2 = typedef vec2<int> |
A 2-dimensional vector with int
components.
| using tue::ivec3 = typedef vec3<int> |
A 3-dimensional vector with int
components.
| using tue::ivec4 = typedef vec4<int> |
A 4-dimensional vector with int
components.
| using tue::uvec2 = typedef vec2<unsigned int> |
A 2-dimensional vector with unsigned int
components.
| using tue::uvec3 = typedef vec3<unsigned int> |
A 3-dimensional vector with unsigned int
components.
| using tue::uvec4 = typedef vec4<unsigned int> |
A 4-dimensional vector with unsigned int
components.
|
inlinenoexcept |
Computes the unary plus of each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
v
.
|
inlinenoexcept |
Computes the unary minus of each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
v
.
|
inlinenoexcept |
Computes the bitwise NOT of each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
v
.
|
inlinenoexcept |
Computes the sums of lhs
and each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each component of rhs
.
|
inlinenoexcept |
Computes the sums of each component of lhs
and rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and rhs
.
|
inlinenoexcept |
Computes the sums of each component of lhs
and each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each corresponding component of rhs
.
|
inlinenoexcept |
Computes the differences between lhs
and each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each component of rhs
.
|
inlinenoexcept |
Computes the differences between each component of lhs
and rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and rhs
.
|
inlinenoexcept |
Computes the differences between each component of lhs
and each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each corresponding component of rhs
.
|
inlinenoexcept |
Computes the products of lhs
and each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each component of rhs
.
|
inlinenoexcept |
Computes the products of each component of lhs
and rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and rhs
.
|
inlinenoexcept |
Computes the products of each component of lhs
and each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each corresponding component of rhs
.
|
inlinenoexcept |
Computes the quotients of lhs
over each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
over each component of rhs
.
|
inlinenoexcept |
Computes the quotients of each component of lhs
over rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
over rhs
.
|
inlinenoexcept |
Computes the quotients of each component of lhs
over each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
over each corresponding component of rhs
.
|
inlinenoexcept |
Computes the modulos of lhs
over each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
over each component of rhs
.
|
inlinenoexcept |
Computes the modulos of each component of lhs
over rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
over rhs
.
|
inlinenoexcept |
Computes the modulos of each component of lhs
over each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
over each corresponding component of rhs
.
|
inlinenoexcept |
Computes the bitwise AND of lhs
and each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each component of rhs
.
|
inlinenoexcept |
Computes the bitwise AND of each component of lhs
and rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and rhs
.
|
inlinenoexcept |
Computes the bitwise AND of each component of lhs
and each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each corresponding component of rhs
.
|
inlinenoexcept |
Computes the bitwise OR of lhs
and each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each component of rhs
.
|
inlinenoexcept |
Computes the bitwise OR of each component of lhs
and rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and rhs
.
|
inlinenoexcept |
Computes the bitwise OR of each component of lhs
and each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each corresponding component of rhs
.
|
inlinenoexcept |
Computes the bitwise XOR of lhs
and each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each component of rhs
.
|
inlinenoexcept |
Computes the bitwise XOR of each component of lhs
and rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and rhs
.
|
inlinenoexcept |
Computes the bitwise XOR of each component of lhs
and each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and each corresponding component of rhs
.
|
inlinenoexcept |
Computes the bitwise shifts left of lhs
by each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
by each component of rhs
.
|
inlinenoexcept |
Computes the bitwise shifts left of each component of lhs
by rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
by rhs
.
|
inlinenoexcept |
Computes the bitwise shifts left of each component of lhs
by each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
by each corresponding component of rhs
.
|
inlinenoexcept |
Computes the bitwise shifts right of lhs
by each component of rhs
.
| T | The type of parameter lhs . |
| U | The component type of rhs . |
| N | The component count of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
by each component of rhs
.
|
inlinenoexcept |
Computes the bitwise shifts right of each component of lhs
by rhs
.
| T | The component type of lhs . |
| U | The type of parameter rhs . |
| N | The component count of lhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
by rhs
.
|
inlinenoexcept |
Computes the bitwise shifts right of each component of lhs
by each corresponding component of rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
by each corresponding component of rhs
.
|
inlinenoexcept |
Determines whether or not two vec
's compare equal.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
true
if all the corresponding pairs of components compare equal and false
otherwise.
|
inlinenoexcept |
Determines whether or not two vec
's compare not equal.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
true
if at least one of the corresponding pairs of components compares not equal and false
otherwise.
|
inlinenoexcept |
Computes tue::math::sin()
for each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
tue::math::sin()
for each component of v
.
|
inlinenoexcept |
Computes tue::math::cos()
for each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
tue::math::cos()
for each component of v
.
|
inlinenoexcept |
Computes tue::math::sincos()
for each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
| sin_out | A reference to the vec to store the sin() results in. |
| cos_out | A reference to the vec to store the cos() results in. |
|
inlinenoexcept |
Computes tue::math::exp()
for each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
tue::math::exp()
for each component of v
.
|
inlinenoexcept |
Computes tue::math::log()
for each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
tue::math::log()
for each component of v
.
|
inlinenoexcept |
Computes tue::math::abs()
for each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
tue::math::abs()
for each component of v
.
|
inlinenoexcept |
Computes tue::math::pow()
for each component of bases
and each corresponding component of exponents
.
| T | The component type of both bases and exponents . |
| N | The component count of both bases and exponents . |
| bases | The bases. |
| exponents | The exponents. |
tue::math::pow()
for each component of bases
and each corresponding component of exponents
.
|
inlinenoexcept |
Computes tue::math::recip()
for each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
tue::math::recip()
for each component of v
.
|
inlinenoexcept |
Computes tue::math::sqrt()
for each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
tue::math::sqrt()
for each component of v
.
|
inlinenoexcept |
Computes tue::math::rsqrt()
for each component of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
tue::math::rsqrt()
for each component of v
.
|
inlinenoexcept |
Computes tue::math::min()
for each corresponding pair of components from v1
and v2
.
| T | The component type of both v1 and v2 . |
| N | The component count of both v1 and v2 . |
| v1 | A vec . |
| v2 | Another vec . |
tue::math::min()
for each corresponding pair of components from v1
and v2
.
|
inlinenoexcept |
Computes tue::math::max()
for each corresponding pair of components from v1
and v2
.
| T | The component type of both v1 and v2 . |
| N | The component count of both v1 and v2 . |
| v1 | A vec . |
| v2 | Another vec . |
tue::math::max()
for each corresponding pair of components from v1
and v2
.
|
inlinenoexcept |
Computes tue::math::mask()
for each corresponding pair of components from conditions
and values
.
| T | The component type of conditions . |
| U | The component type of values . |
| N | The component count of both conditions and values . |
| conditions | A vec . |
| values | Another vec . |
tue::math::mask()
for each corresponding pair of components from conditions
and values
.
|
inlinenoexcept |
Computes tue::math::select()
for each corresponding trio of components from conditions
, values
, and otherwise
.
| T | The component type of conditions . |
| U | The component type of both values and otherwise . |
| N | The component count of all three parameters. |
| conditions | A vec . |
| values | Another vec . |
| otherwise | Another vec . |
tue::math::select()
for each corresponding trio of components from conditions
, values
, and otherwise
.
|
inlinenoexcept |
Computes tue::math::less()
for each corresponding pair of components from lhs
and rhs
.
| T | The component type of both lhs and rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
tue::math::less()
for each corresponding pair of components from lhs
and rhs
.
|
inlinenoexcept |
Computes tue::math::less_equal()
for each corresponding pair of components from lhs
and rhs
.
| T | The component type of both lhs and rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
tue::math::less_equal()
for each corresponding pair of components from lhs
and rhs
.
|
inlinenoexcept |
Computes tue::math::greater()
for each corresponding pair of components from lhs
and rhs
.
| T | The component type of both lhs and rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
tue::math::greater()
for each corresponding pair of components from lhs
and rhs
.
|
inlinenoexcept |
Computes tue::math::greater_equal()
for each corresponding pair of components from lhs
and rhs
.
| T | The component type of both lhs and rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
tue::math::greater_equal()
for each corresponding pair of components from lhs
and rhs
.
|
inlinenoexcept |
Computes tue::math::equal()
for each corresponding pair of components from lhs
and rhs
.
| T | The component type of both lhs and rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
tue::math::equal()
for each corresponding pair of components from lhs
and rhs
.
|
inlinenoexcept |
Computes tue::math::not_equal()
for each corresponding pair of components from lhs
and rhs
.
| T | The component type of both lhs and rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
tue::math::not_equal()
for each corresponding pair of components from lhs
and rhs
.
|
inlinenoexcept |
Computes the dot product of lhs
and rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| N | The component count of both lhs and rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and rhs
.
|
inlinenoexcept |
Computes the cross product of lhs
and rhs
.
| T | The component type of lhs . |
| U | The component type of rhs . |
| lhs | The left-hand side operand. |
| rhs | The right-hand side operand. |
lhs
and rhs
.
|
inlinenoexcept |
Computes the vector length of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
v
.
|
inlinenoexcept |
Computes the vector length squared of v
.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
v
.
|
inlinenoexcept |
Computes the reciprocal of the vector length of v
.
If the vector length of v
equals 0
, behavior is undefined.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
v
.
|
inlinenoexcept |
Computes a normalized copy of v
.
If the vector length of v
equals 0
, behavior is undefined.
| T | The component type of v . |
| N | The component count of v . |
| v | A vec . |
v
.


The typical M/EEG workflow¶
Contents
Overview¶
This section describes a typical MEG/EEG workflow, eventually up to source reconstruction. The workflow is summarized in Workflow of the MNE software. References below refer to Python functions and objects.
Preprocessing¶
The following MEG and EEG data preprocessing steps are recommended:
Bad channels in the MEG and EEG data must be identified, see Marking bad channels.
The data has to be filtered to the desired passband.
Artifacts should be suppressed (e.g., using ICA or SSP).
Marking bad channels¶
Sometimes some MEG or EEG channels are not functioning properly for various reasons. These channels should be excluded from analysis by marking them bad as:
>>> raw.info['bads'] = ['MEG2443']
Especially if a channel does not show a signal at all (flat) it is important to exclude it from the analysis, since its noise estimate will be unrealistically low and thus the current estimate calculations will give a strong weight to the zero signal on the flat channels and will essentially vanish. It is also important to exclude noisy channels because they can possibly affect others when signal-space projections or EEG average electrode reference is employed. Noisy bad channels can also adversely affect averaging and noise-covariance matrix estimation by causing unnecessary rejections of epochs.
Recommended ways to identify bad channels are:
Observe the quality of data during data acquisition and make notes of observed malfunctioning channels to your measurement protocol sheet.
View the on-line averages and check the condition of the channels.
Compute preliminary off-line averages with artifact rejection, SSP/ICA, and EEG average electrode reference computation off and check the condition of the channels.
View raw data with
mne.io.Raw.plot()
without SSP/ICA enabled and identify bad channels.
Note
It is strongly recommended that bad channels are identified and marked in the original raw data files. If present in the raw data files, the bad channel selections will be automatically transferred to averaged files, noise-covariance matrices, forward solution files, and inverse operator decompositions.
Artifact suppression¶
SSP¶
The Signal-Space Projection (SSP) is one approach to rejection of external disturbances in software. Unlike many other noise-cancellation approaches, SSP does not require additional reference sensors to record the disturbance fields. Instead, SSP relies on the fact that the magnetic field distributions generated by the sources in the brain have spatial distributions sufficiently different from those generated by external noise sources. Furthermore, it is implicitly assumed that the linear space spanned by the significant external noise patters has a low dimension.
SSP-based rejection is often done using the
mne.preprocessing.compute_proj_ecg()
and
mne.preprocessing.compute_proj_eog()
methods, see
Background on projectors and projections and Repairing artifacts with SSP for more
information.
ICA¶
Many M/EEG signals including biological artifacts reflect non-Gaussian processes. Therefore PCA-based artifact rejection will likely perform worse at separating the signal from noise sources.
ICA-based artifact rejection is done using the mne.preprocessing.ICA
class, see the Background on Independent Component Analysis (ICA) section for more information.
Epoching and evoked data¶
Epoching of raw data is done using events, which define a t=0
for your
data chunks. Event times stamped to the acquisition software can be extracted
using mne.find_events()
:
>>> events = mne.find_events(raw)
The events
array can then be modified, extended, or changed if necessary.
If the original trigger codes and trigger times are correct for the analysis
of interest, mne.Epochs
for the first event type (1
) can be
constructed using:
>>> reject = dict(grad=4000e-13, mag=4e-12, eog=150e-6)
>>> epochs = mne.Epochs(raw, events, event_id=1, tmin=-0.2, tmax=0.5,
>>> proj=True, picks=picks, baseline=(None, 0),
>>> preload=True, reject=reject)
Note
The rejection thresholds (set with argument reject
) are defined
in T / m for gradiometers, T for magnetometers and V for EEG and EOG
channels.
Rejection using annotations¶
The reject keyword of mne.Epochs
is used for rejecting bad epochs
based on peak-to-peak thresholds. Bad segments of data can also be rejected
by marking segments of raw data with annotations. See
Rejecting bad data spans and mne.Annotations
for more .
Once the mne.Epochs
are constructed, they can be averaged to obtain
mne.Evoked
data as:
>>> evoked = epochs.average()
Source localization¶
MNE makes extensive use of the FreeSurfer file structure for analysis.
Before starting data analysis, we recommend setting up the environment
variable SUBJECTS_DIR
(or set it permanently using mne.set_config()
)
to select the directory under which the anatomical MRI data are stored.
This makes it so that the subjects_dir
argument does not need to
be passed to many functions.
Anatomical information¶
Cortical surface reconstruction with FreeSurfer¶
The first processing stage is the creation of various surface reconstructions with FreeSurfer. The recommended FreeSurfer workflow is summarized on the FreeSurfer wiki pages. See also this information FreeSurfer MRI reconstruction.
Setting up the source space¶
This stage consists of the following:
Creating a suitable decimated dipole grid on the white matter surface.
Creating the source space file in fif format.
This is accomplished with using mne.setup_source_space()
and
mne.write_source_spaces()
. These assume that the anatomical MRI processing
has been completed as described in Cortical surface reconstruction with FreeSurfer.
|
Sources per hemisphere |
Source spacing / mm |
Surface area per source / mm2 |
|---|---|---|---|
|
1026 |
9.9 |
97 |
|
2562 |
6.2 |
39 |
|
4098 |
4.9 |
24 |
|
10242 |
3.1 |
9.8 |
For example, to create the reconstruction geometry for subject='sample'
with a ~5-mm spacing between the grid points, say:
>>> src = setup_source_space('sample', spacing='oct6')
>>> write_source_spaces('sample-oct6-src.fif', src)
This creates the source spaces and writes them to disk.
Compute Source Space illustrates how the source space is used to compute the forward model.
Creating the BEM model meshes¶
Calculation of the forward solution using the boundary-element model (BEM) requires that the surfaces separating regions of different electrical conductivities are tessellated with suitable surface elements. Our BEM software employs triangular tessellations. Therefore, prerequisites for BEM calculations are the segmentation of the MRI data and the triangulation of the relevant surfaces.
For MEG computations, a reasonably accurate solution can be obtained by using a single-compartment BEM assuming the shape of the intracranial volume. For EEG, the standard model contains the intracranial space, the skull, and the scalp.
At present, no bulletproof method exists for creating the triangulations. Feasible approaches are described in The Boundary Element Model (BEM).
Setting up the head surface triangulation files¶
The segmentation algorithms described in The Boundary Element Model (BEM) produce either FreeSurfer surfaces or triangulation data in text. Before proceeding to the creation of the boundary element model, standard files for FreeSurfer surfaces must be present:
inner_skull.surf contains the inner skull triangulation.
outer_skull.surf contains the outer skull triangulation.
outer_skin.surf contains the head surface triangulation.
Setting up the boundary-element model¶
This stage sets up the subject-dependent data for computing the forward solutions:”
>>> model = make_bem_model('sample')
>>> write_bem_surfaces('sample-5120-5120-5120-bem.fif', model)
Where surfaces
is a list of BEM surfaces that have each been read using
mne.read_surface()
. This step also checks that the input surfaces
are complete and that they are topologically correct, i.e.,
that the surfaces do not intersect and that the surfaces are correctly
ordered (outer skull surface inside the scalp and inner skull surface
inside the outer skull).
This step assigns the conductivity values to the BEM compartments. For the scalp and the brain compartments, the default is 0.3 S/m. The default skull conductivity is 50 times smaller, i.e., 0.006 S/m. Recent publications, see Forward modeling, report a range of skull conductivity ratios ranging from 1:15 (Oostendorp et al., 2000) to 1:25 - 1:50 (Slew et al., 2009, Conçalves et al., 2003). The MNE default ratio 1:50 is based on the typical values reported in (Conçalves et al., 2003), since their approach is based comparison of SEF/SEP measurements in a BEM model. The variability across publications may depend on individual variations but, more importantly, on the precision of the skull compartment segmentation.
Note
To produce single layer BEM models (–homog flag in the C command
line tools) pass a list with one single conductivity value,
e.g. conductivities=[0.3]
.
Using this model, the BEM solution can be computed using
mne.make_bem_solution()
as:
>>> bem_sol = make_bem_solution(model)
>>> write_bem_solution('sample-5120-5120-5120-bem-sol.fif', bem_sol)
After the BEM is set up it is advisable to check that the
BEM model meshes are correctly positioned using e.g.
mne.viz.plot_alignment()
or mne.Report
.
Note
Up to this point all processing stages depend on the anatomical (geometrical) information only and thus remain identical across different MEG studies.
Note
If you use custom head models you might need to set the ico=None
parameter to None
and skip subsampling of the surface.
Aligning coordinate frames¶
The calculation of the forward solution requires knowledge of the relative location and orientation of the MEG/EEG and MRI coordinate systems (see The head and device coordinate systems). The head coordinate frame is defined by identifying the fiducial landmark locations, making the origin and orientation of the head coordinate system slightly user dependent. As a result, it is safest to reestablish the definition of the coordinate transformation computation for each experimental session, i.e., each time when new head digitization data are employed.
The corregistration is stored in -trans.fif
file. If is present,
you can follow Source alignment and coordinate frames to validate its correctness.
If the -trans.fif
is not present or the alignment is not correct
you need to use mne.gui.coregistration()
(or its convenient command line
equivalent mne coreg) to generate it.
Warning
This step is important. If the alignment of the coordinate frames is inaccurate all subsequent processing steps suffer from the error. Therefore, this step should be performed by the person in charge of the study or by a trained technician. Written or photographic documentation of the alignment points employed during the MEG/EEG acquisition can also be helpful.
Computing the forward solution¶
After the MRI-MEG/EEG alignment has been set, the forward
solution, i.e., the magnetic fields and electric
potentials at the measurement sensors and electrodes due to dipole
sources located on the cortex, can be calculated with help of
mne.make_forward_solution()
as:
>>> fwd = make_forward_solution(raw.info, fname_trans, src, bem_sol)
Computing the noise-covariance matrix¶
The MNE software employs an estimate of the noise-covariance matrix to weight the channels correctly in the calculations. The noise-covariance matrix provides information about field and potential patterns representing uninteresting noise sources of either human or environmental origin.
The noise covariance matrix can be calculated in several ways:
Employ the individual epochs during off-line averaging to calculate the full noise covariance matrix. This is the recommended approach for evoked responses, e.g. using
mne.compute_covariance()
:>>> cov = mne.compute_covariance(epochs, method='auto')
Employ empty room data (collected without the subject) to calculate the full noise covariance matrix. This is recommended for analyzing ongoing spontaneous activity. This can be done using
mne.compute_raw_covariance()
as:>>> cov = mne.compute_raw_covariance(raw_erm)
Employ a section of continuous raw data collected in the presence of the subject to calculate the full noise covariance matrix. This is the recommended approach for analyzing epileptic activity. The data used for this purpose should be free of technical artifacts and epileptic activity of interest. The length of the data segment employed should be at least 20 seconds. One can also use a long (
*> 200 s
) segment of data with epileptic spikes present provided that the spikes occur infrequently and that the segment is apparently stationary with respect to background brain activity. This can also usemne.compute_raw_covariance()
.
Calculating the inverse operator¶
The MNE software doesn’t calculate the inverse operator explicitly but rather computes an SVD of a matrix composed of the noise-covariance matrix, the result of the forward calculation, and the source covariance matrix. This approach has the benefit that the regularization parameter (‘SNR’) can be adjusted easily when the final source estimates or dSPMs are computed. For mathematical details of this approach, please consult The minimum-norm current estimates.
This computation stage can be done by using
mne.minimum_norm.make_inverse_operator()
as:
>>> inv = mne.minimum_norm.make_inverse_operator(raw.info, fwd, cov, loose=0.2)
Creating source estimates¶
Once all the preprocessing steps described above have been completed, the inverse operator computed can be applied to the MEG and EEG data as:
>>> stc = mne.minimum_norm.apply_inverse(evoked, inv, lambda2=1. / 9.)
And the results can be viewed as:
>>> stc.plot()
Group analyses¶
Group analysis is facilitated by morphing source estimates, which can be
done e.g., to subject='fsaverage'
as:
>>> morph = mne.compute_source_morph(stc, subject_from='sample', subject_to='fsaverage')
>>> stc_fsaverage = morph.apply(stc)
See Morphing and averaging source estimates for more information.


FoK
Coffee Tea Ancora Sprouts Nuts Spice Harvest Essentials Yemoos Hufford Seattle Spirits Prairie Moon
Here are some of my own recipies. Some ay be rather deriviative, but others are the fruits of my own inspiration and trial and error.
Scones Raisin Bread Veggie Burgers Hummus


Plays a demo tour traveling through various fake sensors showing all possible measured magnitudes implemented on the api server.
Plays a demo tour of an overlay with various layers of fake processed photos.
Stops the current demo


My professional background
- I studied ChemE in College.
- I was as an engineer for a bunch of different manufacturing plants! One of which made Pyrex.
- I've always been interested in software, and I hope to take the skills I learn from this class and apply them to my engineering career.


The map below can be a bit slow with many points, so it doesn't update automatically. Please click the button below when you want to update the points rendered on the map to reflect the markers selected on the Google map above. Then select the attribute to color the points by using the selector below. Use the scroll wheel on a mouse or two fingers on a Mac trackpad to zoom in/out. Click and drag is used to translate the map.


Delivering Engineering excellence to build a greater nation
*For inquiries, please feel free to contact us at protech@pcdcphilippines.com


Close Recently added item(s)
You have no items in your shopping cart.
SKU# E24-BG
Availability: In stock


{% load static %}
{{ product.product_name }}
Home
About Us
Products
FAQS
Contact Us
Register
Roll over image to zoom in
{% include 'products/like_button.html' %}
{{ product.product_name }}
Sold on Amazon and Ebay
Amazon Price: ${{ product.amazon_price }}
E-bay Price: ${{ product.ebay_price }}
{{ product.description }}
{{ list_lines|unordered_list }}
Visit Amazon Site
Visit E-bay Site


A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete and ajax support.


Alex Gibson
Hi! My name is Alex Gibson and I'm a Front-End Web Developer living in Newcastle upon Tyne, United Kingdom. I currently work for Mozilla. I'm passionate about the open web, browsers, and web standards.

You can find me online in the following places: