1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186 |
- using System;
- using System.Runtime.InteropServices;
- using System.Runtime.CompilerServices;
- using Unity.IL2CPP.CompilerServices;
-
- namespace Unity.Mathematics
- {
- /// <summary>
- /// A static class to contain various math functions and constants.
- /// </summary>
- [Il2CppEagerStaticClassConstruction]
- public static partial class math
- {
- /// <summary>Extrinsic rotation order. Specifies in which order rotations around the principal axes (x, y and z) are to be applied.</summary>
- public enum RotationOrder : byte
- {
- /// <summary>Extrinsic rotation around the x axis, then around the y axis and finally around the z axis.</summary>
- XYZ,
- /// <summary>Extrinsic rotation around the x axis, then around the z axis and finally around the y axis.</summary>
- XZY,
- /// <summary>Extrinsic rotation around the y axis, then around the x axis and finally around the z axis.</summary>
- YXZ,
- /// <summary>Extrinsic rotation around the y axis, then around the z axis and finally around the x axis.</summary>
- YZX,
- /// <summary>Extrinsic rotation around the z axis, then around the x axis and finally around the y axis.</summary>
- ZXY,
- /// <summary>Extrinsic rotation around the z axis, then around the y axis and finally around the x axis.</summary>
- ZYX,
- /// <summary>Unity default rotation order. Extrinsic Rotation around the z axis, then around the x axis and finally around the y axis.</summary>
- Default = ZXY
- };
-
- /// <summary>Specifies a shuffle component.</summary>
- public enum ShuffleComponent : byte
- {
- /// <summary>Specified the x component of the left vector.</summary>
- LeftX,
- /// <summary>Specified the y component of the left vector.</summary>
- LeftY,
- /// <summary>Specified the z component of the left vector.</summary>
- LeftZ,
- /// <summary>Specified the w component of the left vector.</summary>
- LeftW,
-
- /// <summary>Specified the x component of the right vector.</summary>
- RightX,
- /// <summary>Specified the y component of the right vector.</summary>
- RightY,
- /// <summary>Specified the z component of the right vector.</summary>
- RightZ,
- /// <summary>Specified the w component of the right vector.</summary>
- RightW
- };
-
- /// <summary>The mathematical constant e also known as Euler's number. Approximately 2.72. This is a f64/double precision constant.</summary>
- public const double E_DBL = 2.71828182845904523536;
-
- /// <summary>The base 2 logarithm of e. Approximately 1.44. This is a f64/double precision constant.</summary>
- public const double LOG2E_DBL = 1.44269504088896340736;
-
- /// <summary>The base 10 logarithm of e. Approximately 0.43. This is a f64/double precision constant.</summary>
- public const double LOG10E_DBL = 0.434294481903251827651;
-
- /// <summary>The natural logarithm of 2. Approximately 0.69. This is a f64/double precision constant.</summary>
- public const double LN2_DBL = 0.693147180559945309417;
-
- /// <summary>The natural logarithm of 10. Approximately 2.30. This is a f64/double precision constant.</summary>
- public const double LN10_DBL = 2.30258509299404568402;
-
- /// <summary>The mathematical constant pi. Approximately 3.14. This is a f64/double precision constant.</summary>
- public const double PI_DBL = 3.14159265358979323846;
-
- /// <summary>
- /// The mathematical constant (2 * pi). Approximately 6.28. This is a f64/double precision constant. Also known as <see cref="TAU_DBL"/>.
- /// </summary>
- public const double PI2_DBL = PI_DBL * 2.0;
-
- /// <summary>
- /// The mathematical constant (pi / 2). Approximately 1.57. This is a f64/double precision constant.
- /// </summary>
- public const double PIHALF_DBL = PI_DBL * 0.5;
-
- /// <summary>
- /// The mathematical constant tau. Approximately 6.28. This is a f64/double precision constant. Also known as <see cref="PI2_DBL"/>.
- /// </summary>
- public const double TAU_DBL = PI2_DBL;
-
- /// <summary>
- /// The conversion constant used to convert radians to degrees. Multiply the radian value by this constant to get degrees.
- /// </summary>
- /// <remarks>Multiplying by this constant is equivalent to using <see cref="math.degrees(double)"/>.</remarks>
- public const double TODEGREES_DBL = 57.29577951308232;
-
- /// <summary>
- /// The conversion constant used to convert degrees to radians. Multiply the degree value by this constant to get radians.
- /// </summary>
- /// <remarks>Multiplying by this constant is equivalent to using <see cref="math.radians(double)"/>.</remarks>
- public const double TORADIANS_DBL = 0.017453292519943296;
-
- /// <summary>The square root 2. Approximately 1.41. This is a f64/double precision constant.</summary>
- public const double SQRT2_DBL = 1.41421356237309504880;
-
- /// <summary>
- /// The difference between 1.0 and the next representable f64/double precision number.
- ///
- /// Beware:
- /// This value is different from System.Double.Epsilon, which is the smallest, positive, denormalized f64/double.
- /// </summary>
- public const double EPSILON_DBL = 2.22044604925031308085e-16;
-
- /// <summary>
- /// Double precision constant for positive infinity.
- /// </summary>
- public const double INFINITY_DBL = Double.PositiveInfinity;
-
- /// <summary>
- /// Double precision constant for Not a Number.
- ///
- /// NAN_DBL is considered unordered, which means all comparisons involving it are false except for not equal (operator !=).
- /// As a consequence, NAN_DBL == NAN_DBL is false but NAN_DBL != NAN_DBL is true.
- ///
- /// Additionally, there are multiple bit representations for Not a Number, so if you must test if your value
- /// is NAN_DBL, use isnan().
- /// </summary>
- public const double NAN_DBL = Double.NaN;
-
- /// <summary>The smallest positive normal number representable in a float.</summary>
- public const float FLT_MIN_NORMAL = 1.175494351e-38F;
-
- /// <summary>The smallest positive normal number representable in a double. This is a f64/double precision constant.</summary>
- public const double DBL_MIN_NORMAL = 2.2250738585072014e-308;
-
- /// <summary>The mathematical constant e also known as Euler's number. Approximately 2.72.</summary>
- public const float E = (float)E_DBL;
-
- /// <summary>The base 2 logarithm of e. Approximately 1.44.</summary>
- public const float LOG2E = (float)LOG2E_DBL;
-
- /// <summary>The base 10 logarithm of e. Approximately 0.43.</summary>
- public const float LOG10E = (float)LOG10E_DBL;
-
- /// <summary>The natural logarithm of 2. Approximately 0.69.</summary>
- public const float LN2 = (float)LN2_DBL;
-
- /// <summary>The natural logarithm of 10. Approximately 2.30.</summary>
- public const float LN10 = (float)LN10_DBL;
-
- /// <summary>The mathematical constant pi. Approximately 3.14.</summary>
- public const float PI = (float)PI_DBL;
-
- /// <summary>
- /// The mathematical constant (2 * pi). Approximately 6.28. Also known as <see cref="TAU"/>.
- /// </summary>
- public const float PI2 = (float)PI2_DBL;
-
- /// <summary>
- /// The mathematical constant (pi / 2). Approximately 1.57.
- /// </summary>
- public const float PIHALF = (float)PIHALF_DBL;
-
- /// <summary>
- /// The mathematical constant tau. Approximately 6.28. Also known as <see cref="PI2"/>.
- /// </summary>
- public const float TAU = (float)PI2_DBL;
-
- /// <summary>
- /// The conversion constant used to convert radians to degrees. Multiply the radian value by this constant to get degrees.
- /// </summary>
- /// <remarks>Multiplying by this constant is equivalent to using <see cref="math.degrees(float)"/>.</remarks>
- public const float TODEGREES = (float)TODEGREES_DBL;
-
- /// <summary>
- /// The conversion constant used to convert degrees to radians. Multiply the degree value by this constant to get radians.
- /// </summary>
- /// <remarks>Multiplying by this constant is equivalent to using <see cref="math.radians(float)"/>.</remarks>
- public const float TORADIANS = (float)TORADIANS_DBL;
-
- /// <summary>The square root 2. Approximately 1.41.</summary>
- public const float SQRT2 = (float)SQRT2_DBL;
-
- /// <summary>
- /// The difference between 1.0f and the next representable f32/single precision number.
- ///
- /// Beware:
- /// This value is different from System.Single.Epsilon, which is the smallest, positive, denormalized f32/single.
- /// </summary>
- public const float EPSILON = 1.1920928955078125e-7f;
-
- /// <summary>
- /// Single precision constant for positive infinity.
- /// </summary>
- public const float INFINITY = Single.PositiveInfinity;
-
- /// <summary>
- /// Single precision constant for Not a Number.
- ///
- /// NAN is considered unordered, which means all comparisons involving it are false except for not equal (operator !=).
- /// As a consequence, NAN == NAN is false but NAN != NAN is true.
- ///
- /// Additionally, there are multiple bit representations for Not a Number, so if you must test if your value
- /// is NAN, use isnan().
- /// </summary>
- public const float NAN = Single.NaN;
-
- /// <summary>Returns the bit pattern of a uint as an int.</summary>
- /// <param name="x">The uint bits to copy.</param>
- /// <returns>The int with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int asint(uint x)
- {
- unsafe
- {
- return *(int*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a uint2 as an int2.</summary>
- /// <param name="x">The uint2 bits to copy.</param>
- /// <returns>The int2 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 asint(uint2 x)
- {
- unsafe
- {
- return *(int2*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a uint3 as an int3.</summary>
- /// <param name="x">The uint3 bits to copy.</param>
- /// <returns>The int3 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 asint(uint3 x)
- {
- unsafe
- {
- return *(int3*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a uint4 as an int4.</summary>
- /// <param name="x">The uint4 bits to copy.</param>
- /// <returns>The int4 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 asint(uint4 x)
- {
- unsafe
- {
- return *(int4*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a float as an int.</summary>
- /// <param name="x">The float bits to copy.</param>
- /// <returns>The int with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int asint(float x)
- {
- unsafe
- {
- return *(int*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a float2 as an int2.</summary>
- /// <param name="x">The float2 bits to copy.</param>
- /// <returns>The int2 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 asint(float2 x)
- {
- unsafe
- {
- return *(int2*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a float3 as an int3.</summary>
- /// <param name="x">The float3 bits to copy.</param>
- /// <returns>The int3 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 asint(float3 x)
- {
- unsafe
- {
- return *(int3*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a float4 as an int4.</summary>
- /// <param name="x">The float4 bits to copy.</param>
- /// <returns>The int4 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 asint(float4 x)
- {
- unsafe
- {
- return *(int4*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of an int as a uint.</summary>
- /// <param name="x">The int bits to copy.</param>
- /// <returns>The uint with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint asuint(int x) { return (uint)x; }
-
- /// <summary>Returns the bit pattern of an int2 as a uint2.</summary>
- /// <param name="x">The int2 bits to copy.</param>
- /// <returns>The uint2 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 asuint(int2 x)
- {
- unsafe
- {
- return *(uint2*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of an int3 as a uint3.</summary>
- /// <param name="x">The int3 bits to copy.</param>
- /// <returns>The uint3 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 asuint(int3 x)
- {
- unsafe
- {
- return *(uint3*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of an int4 as a uint4.</summary>
- /// <param name="x">The int4 bits to copy.</param>
- /// <returns>The uint4 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 asuint(int4 x)
- {
- unsafe
- {
- return *(uint4*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a float as a uint.</summary>
- /// <param name="x">The float bits to copy.</param>
- /// <returns>The uint with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint asuint(float x)
- {
- unsafe
- {
- return *(uint*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a float2 as a uint2.</summary>
- /// <param name="x">The float2 bits to copy.</param>
- /// <returns>The uint2 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 asuint(float2 x)
- {
- unsafe
- {
- return *(uint2*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a float3 as a uint3.</summary>
- /// <param name="x">The float3 bits to copy.</param>
- /// <returns>The uint3 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 asuint(float3 x)
- {
- unsafe
- {
- return *(uint3*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a float4 as a uint4.</summary>
- /// <param name="x">The float4 bits to copy.</param>
- /// <returns>The uint4 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 asuint(float4 x)
- {
- unsafe
- {
- return *(uint4*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a ulong as a long.</summary>
- /// <param name="x">The ulong bits to copy.</param>
- /// <returns>The long with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long aslong(ulong x) { return (long)x; }
-
- /// <summary>Returns the bit pattern of a double as a long.</summary>
- /// <param name="x">The double bits to copy.</param>
- /// <returns>The long with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long aslong(double x)
- {
- unsafe
- {
- return *(long*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a long as a ulong.</summary>
- /// <param name="x">The long bits to copy.</param>
- /// <returns>The ulong with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong asulong(long x) { return (ulong)x; }
-
- /// <summary>Returns the bit pattern of a double as a ulong.</summary>
- /// <param name="x">The double bits to copy.</param>
- /// <returns>The ulong with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong asulong(double x)
- {
- unsafe
- {
- return *(ulong*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of an int as a float.</summary>
- /// <param name="x">The int bits to copy.</param>
- /// <returns>The float with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float asfloat(int x)
- {
- unsafe
- {
- return *(float*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of an int2 as a float2.</summary>
- /// <param name="x">The int2 bits to copy.</param>
- /// <returns>The float2 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 asfloat(int2 x)
- {
- unsafe
- {
- return *(float2*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of an int3 as a float3.</summary>
- /// <param name="x">The int3 bits to copy.</param>
- /// <returns>The float3 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 asfloat(int3 x)
- {
- unsafe
- {
- return *(float3*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of an int4 as a float4.</summary>
- /// <param name="x">The int4 bits to copy.</param>
- /// <returns>The float4 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 asfloat(int4 x)
- {
- unsafe
- {
- return *(float4*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a uint as a float.</summary>
- /// <param name="x">The uint bits to copy.</param>
- /// <returns>The float with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float asfloat(uint x)
- {
- unsafe
- {
- return *(float*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a uint2 as a float2.</summary>
- /// <param name="x">The uint2 bits to copy.</param>
- /// <returns>The float2 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 asfloat(uint2 x)
- {
- unsafe
- {
- return *(float2*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a uint3 as a float3.</summary>
- /// <param name="x">The uint3 bits to copy.</param>
- /// <returns>The float3 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 asfloat(uint3 x)
- {
- unsafe
- {
- return *(float3*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a uint4 as a float4.</summary>
- /// <param name="x">The uint4 bits to copy.</param>
- /// <returns>The float4 with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 asfloat(uint4 x)
- {
- unsafe
- {
- return *(float4*)&x;
- }
- }
-
- /// <summary>
- /// Returns a bitmask representation of a bool4. Storing one 1 bit per component
- /// in LSB order, from lower to higher bits (so 4 bits in total).
- /// The component x is stored at bit 0,
- /// The component y is stored at bit 1,
- /// The component z is stored at bit 2,
- /// The component w is stored at bit 3
- /// The bool4(x = true, y = true, z = false, w = true) would produce the value 1011 = 0xB
- /// </summary>
- /// <param name="value">The input bool4 to calculate the bitmask for</param>
- /// <returns>A bitmask representation of the bool4, in LSB order</returns>
- public static int bitmask(bool4 value)
- {
- int mask = 0;
- if (value.x) mask |= 0x01;
- if (value.y) mask |= 0x02;
- if (value.z) mask |= 0x04;
- if (value.w) mask |= 0x08;
- return mask;
- }
-
- /// <summary>Returns the bit pattern of a long as a double.</summary>
- /// <param name="x">The long bits to copy.</param>
- /// <returns>The double with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double asdouble(long x)
- {
- unsafe
- {
- return *(double*)&x;
- }
- }
-
- /// <summary>Returns the bit pattern of a ulong as a double.</summary>
- /// <param name="x">The ulong bits to copy.</param>
- /// <returns>The double with the same bit pattern as the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double asdouble(ulong x)
- {
- unsafe
- {
- return *(double*)&x;
- }
- }
-
- /// <summary>Returns true if the input float is a finite floating point value, false otherwise.</summary>
- /// <param name="x">The float value to test.</param>
- /// <returns>True if the float is finite, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool isfinite(float x) { return abs(x) < float.PositiveInfinity; }
-
- /// <summary>Returns a bool2 indicating for each component of a float2 whether it is a finite floating point value.</summary>
- /// <param name="x">The float2 value to test.</param>
- /// <returns>A bool2 where it is true in a component if that component is finite, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool2 isfinite(float2 x) { return abs(x) < float.PositiveInfinity; }
-
- /// <summary>Returns a bool3 indicating for each component of a float3 whether it is a finite floating point value.</summary>
- /// <param name="x">The float3 value to test.</param>
- /// <returns>A bool3 where it is true in a component if that component is finite, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool3 isfinite(float3 x) { return abs(x) < float.PositiveInfinity; }
-
- /// <summary>Returns a bool4 indicating for each component of a float4 whether it is a finite floating point value.</summary>
- /// <param name="x">The float4 value to test.</param>
- /// <returns>A bool4 where it is true in a component if that component is finite, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool4 isfinite(float4 x) { return abs(x) < float.PositiveInfinity; }
-
-
- /// <summary>Returns true if the input double is a finite floating point value, false otherwise.</summary>
- /// <param name="x">The double value to test.</param>
- /// <returns>True if the double is finite, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool isfinite(double x) { return abs(x) < double.PositiveInfinity; }
-
- /// <summary>Returns a bool2 indicating for each component of a double2 whether it is a finite floating point value.</summary>
- /// <param name="x">The double2 value to test.</param>
- /// <returns>A bool2 where it is true in a component if that component is finite, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool2 isfinite(double2 x) { return abs(x) < double.PositiveInfinity; }
-
- /// <summary>Returns a bool3 indicating for each component of a double3 whether it is a finite floating point value.</summary>
- /// <param name="x">The double3 value to test.</param>
- /// <returns>A bool3 where it is true in a component if that component is finite, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool3 isfinite(double3 x) { return abs(x) < double.PositiveInfinity; }
-
- /// <summary>Returns a bool4 indicating for each component of a double4 whether it is a finite floating point value.</summary>
- /// <param name="x">The double4 value to test.</param>
- /// <returns>A bool4 where it is true in a component if that component is finite, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool4 isfinite(double4 x) { return abs(x) < double.PositiveInfinity; }
-
-
- /// <summary>Returns true if the input float is an infinite floating point value, false otherwise.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>True if the input was an infinite value; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool isinf(float x) { return abs(x) == float.PositiveInfinity; }
-
- /// <summary>Returns a bool2 indicating for each component of a float2 whether it is an infinite floating point value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was an infinite value; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool2 isinf(float2 x) { return abs(x) == float.PositiveInfinity; }
-
- /// <summary>Returns a bool3 indicating for each component of a float3 whether it is an infinite floating point value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was an infinite value; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool3 isinf(float3 x) { return abs(x) == float.PositiveInfinity; }
-
- /// <summary>Returns a bool4 indicating for each component of a float4 whether it is an infinite floating point value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was an infinite value; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool4 isinf(float4 x) { return abs(x) == float.PositiveInfinity; }
-
- /// <summary>Returns true if the input double is an infinite floating point value, false otherwise.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>True if the input was an infinite value; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool isinf(double x) { return abs(x) == double.PositiveInfinity; }
-
- /// <summary>Returns a bool2 indicating for each component of a double2 whether it is an infinite floating point value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was an infinite value; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool2 isinf(double2 x) { return abs(x) == double.PositiveInfinity; }
-
- /// <summary>Returns a bool3 indicating for each component of a double3 whether it is an infinite floating point value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was an infinite value; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool3 isinf(double3 x) { return abs(x) == double.PositiveInfinity; }
-
- /// <summary>Returns a bool4 indicating for each component of a double4 whether it is an infinite floating point value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was an infinite value; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool4 isinf(double4 x) { return abs(x) == double.PositiveInfinity; }
-
-
- /// <summary>Returns true if the input float is a NaN (not a number) floating point value, false otherwise.</summary>
- /// <remarks>
- /// NaN has several representations and may vary across architectures. Use this function to check if you have a NaN.
- /// </remarks>
- /// <param name="x">Input value.</param>
- /// <returns>True if the value was NaN; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool isnan(float x) { return (asuint(x) & 0x7FFFFFFF) > 0x7F800000; }
-
- /// <summary>Returns a bool2 indicating for each component of a float2 whether it is a NaN (not a number) floating point value.</summary>
- /// <remarks>
- /// NaN has several representations and may vary across architectures. Use this function to check if you have a NaN.
- /// </remarks>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was NaN; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool2 isnan(float2 x) { return (asuint(x) & 0x7FFFFFFF) > 0x7F800000; }
-
- /// <summary>Returns a bool3 indicating for each component of a float3 whether it is a NaN (not a number) floating point value.</summary>
- /// <remarks>
- /// NaN has several representations and may vary across architectures. Use this function to check if you have a NaN.
- /// </remarks>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was NaN; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool3 isnan(float3 x) { return (asuint(x) & 0x7FFFFFFF) > 0x7F800000; }
-
- /// <summary>Returns a bool4 indicating for each component of a float4 whether it is a NaN (not a number) floating point value.</summary>
- /// <remarks>
- /// NaN has several representations and may vary across architectures. Use this function to check if you have a NaN.
- /// </remarks>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was NaN; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool4 isnan(float4 x) { return (asuint(x) & 0x7FFFFFFF) > 0x7F800000; }
-
-
- /// <summary>Returns true if the input double is a NaN (not a number) floating point value, false otherwise.</summary>
- /// <remarks>
- /// NaN has several representations and may vary across architectures. Use this function to check if you have a NaN.
- /// </remarks>
- /// <param name="x">Input value.</param>
- /// <returns>True if the value was NaN; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool isnan(double x) { return (asulong(x) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000; }
-
- /// <summary>Returns a bool2 indicating for each component of a double2 whether it is a NaN (not a number) floating point value.</summary>
- /// <remarks>
- /// NaN has several representations and may vary across architectures. Use this function to check if you have a NaN.
- /// </remarks>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was NaN; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool2 isnan(double2 x) {
- return bool2((asulong(x.x) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000,
- (asulong(x.y) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000);
- }
-
- /// <summary>Returns a bool3 indicating for each component of a double3 whether it is a NaN (not a number) floating point value.</summary>
- /// <remarks>
- /// NaN has several representations and may vary across architectures. Use this function to check if you have a NaN.
- /// </remarks>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was NaN; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool3 isnan(double3 x)
- {
- return bool3((asulong(x.x) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000,
- (asulong(x.y) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000,
- (asulong(x.z) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000);
- }
-
- /// <summary>Returns a bool4 indicating for each component of a double4 whether it is a NaN (not a number) floating point value.</summary>
- /// <remarks>
- /// NaN has several representations and may vary across architectures. Use this function to check if you have a NaN.
- /// </remarks>
- /// <param name="x">Input value.</param>
- /// <returns>True if the component was NaN; false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool4 isnan(double4 x)
- {
- return bool4((asulong(x.x) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000,
- (asulong(x.y) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000,
- (asulong(x.z) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000,
- (asulong(x.w) & 0x7FFFFFFFFFFFFFFF) > 0x7FF0000000000000);
- }
-
- /// <summary>
- /// Checks if the input is a power of two.
- /// </summary>
- /// <remarks>If x is less than or equal to zero, then this function returns false.</remarks>
- /// <param name="x">Integer input.</param>
- /// <returns>bool where true indicates that input was a power of two.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool ispow2(int x)
- {
- return x > 0 && ((x & (x - 1)) == 0);
- }
-
- /// <summary>
- /// Checks if each component of the input is a power of two.
- /// </summary>
- /// <remarks>If a component of x is less than or equal to zero, then this function returns false in that component.</remarks>
- /// <param name="x">int2 input</param>
- /// <returns>bool2 where true in a component indicates the same component in the input was a power of two.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool2 ispow2(int2 x)
- {
- return new bool2(ispow2(x.x), ispow2(x.y));
- }
-
- /// <summary>
- /// Checks if each component of the input is a power of two.
- /// </summary>
- /// <remarks>If a component of x is less than or equal to zero, then this function returns false in that component.</remarks>
- /// <param name="x">int3 input</param>
- /// <returns>bool3 where true in a component indicates the same component in the input was a power of two.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool3 ispow2(int3 x)
- {
- return new bool3(ispow2(x.x), ispow2(x.y), ispow2(x.z));
- }
-
- /// <summary>
- /// Checks if each component of the input is a power of two.
- /// </summary>
- /// <remarks>If a component of x is less than or equal to zero, then this function returns false in that component.</remarks>
- /// <param name="x">int4 input</param>
- /// <returns>bool4 where true in a component indicates the same component in the input was a power of two.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool4 ispow2(int4 x)
- {
- return new bool4(ispow2(x.x), ispow2(x.y), ispow2(x.z), ispow2(x.w));
- }
-
- /// <summary>
- /// Checks if the input is a power of two.
- /// </summary>
- /// <remarks>If x is less than or equal to zero, then this function returns false.</remarks>
- /// <param name="x">Unsigned integer input.</param>
- /// <returns>bool where true indicates that input was a power of two.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool ispow2(uint x)
- {
- return x > 0 && ((x & (x - 1)) == 0);
- }
-
- /// <summary>
- /// Checks if each component of the input is a power of two.
- /// </summary>
- /// <remarks>If a component of x is less than or equal to zero, then this function returns false in that component.</remarks>
- /// <param name="x">uint2 input</param>
- /// <returns>bool2 where true in a component indicates the same component in the input was a power of two.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool2 ispow2(uint2 x)
- {
- return new bool2(ispow2(x.x), ispow2(x.y));
- }
-
- /// <summary>
- /// Checks if each component of the input is a power of two.
- /// </summary>
- /// <remarks>If a component of x is less than or equal to zero, then this function returns false in that component.</remarks>
- /// <param name="x">uint3 input</param>
- /// <returns>bool3 where true in a component indicates the same component in the input was a power of two.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool3 ispow2(uint3 x)
- {
- return new bool3(ispow2(x.x), ispow2(x.y), ispow2(x.z));
- }
-
- /// <summary>
- /// Checks if each component of the input is a power of two.
- /// </summary>
- /// <remarks>If a component of x is less than or equal to zero, then this function returns false in that component.</remarks>
- /// <param name="x">uint4 input</param>
- /// <returns>bool4 where true in a component indicates the same component in the input was a power of two.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool4 ispow2(uint4 x)
- {
- return new bool4(ispow2(x.x), ispow2(x.y), ispow2(x.z), ispow2(x.w));
- }
-
- /// <summary>Returns the minimum of two int values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int min(int x, int y) { return x < y ? x : y; }
-
- /// <summary>Returns the componentwise minimum of two int2 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 min(int2 x, int2 y) { return new int2(min(x.x, y.x), min(x.y, y.y)); }
-
- /// <summary>Returns the componentwise minimum of two int3 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 min(int3 x, int3 y) { return new int3(min(x.x, y.x), min(x.y, y.y), min(x.z, y.z)); }
-
- /// <summary>Returns the componentwise minimum of two int4 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 min(int4 x, int4 y) { return new int4(min(x.x, y.x), min(x.y, y.y), min(x.z, y.z), min(x.w, y.w)); }
-
-
- /// <summary>Returns the minimum of two uint values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint min(uint x, uint y) { return x < y ? x : y; }
-
- /// <summary>Returns the componentwise minimum of two uint2 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 min(uint2 x, uint2 y) { return new uint2(min(x.x, y.x), min(x.y, y.y)); }
-
- /// <summary>Returns the componentwise minimum of two uint3 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 min(uint3 x, uint3 y) { return new uint3(min(x.x, y.x), min(x.y, y.y), min(x.z, y.z)); }
-
- /// <summary>Returns the componentwise minimum of two uint4 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 min(uint4 x, uint4 y) { return new uint4(min(x.x, y.x), min(x.y, y.y), min(x.z, y.z), min(x.w, y.w)); }
-
-
- /// <summary>Returns the minimum of two long values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long min(long x, long y) { return x < y ? x : y; }
-
-
- /// <summary>Returns the minimum of two ulong values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong min(ulong x, ulong y) { return x < y ? x : y; }
-
-
- /// <summary>Returns the minimum of two float values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float min(float x, float y) { return float.IsNaN(y) || x < y ? x : y; }
-
- /// <summary>Returns the componentwise minimum of two float2 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 min(float2 x, float2 y) { return new float2(min(x.x, y.x), min(x.y, y.y)); }
-
- /// <summary>Returns the componentwise minimum of two float3 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 min(float3 x, float3 y) { return new float3(min(x.x, y.x), min(x.y, y.y), min(x.z, y.z)); }
-
- /// <summary>Returns the componentwise minimum of two float4 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 min(float4 x, float4 y) { return new float4(min(x.x, y.x), min(x.y, y.y), min(x.z, y.z), min(x.w, y.w)); }
-
-
- /// <summary>Returns the minimum of two double values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double min(double x, double y) { return double.IsNaN(y) || x < y ? x : y; }
-
- /// <summary>Returns the componentwise minimum of two double2 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 min(double2 x, double2 y) { return new double2(min(x.x, y.x), min(x.y, y.y)); }
-
- /// <summary>Returns the componentwise minimum of two double3 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 min(double3 x, double3 y) { return new double3(min(x.x, y.x), min(x.y, y.y), min(x.z, y.z)); }
-
- /// <summary>Returns the componentwise minimum of two double4 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise minimum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 min(double4 x, double4 y) { return new double4(min(x.x, y.x), min(x.y, y.y), min(x.z, y.z), min(x.w, y.w)); }
-
-
- /// <summary>Returns the maximum of two int values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int max(int x, int y) { return x > y ? x : y; }
-
- /// <summary>Returns the componentwise maximum of two int2 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 max(int2 x, int2 y) { return new int2(max(x.x, y.x), max(x.y, y.y)); }
-
- /// <summary>Returns the componentwise maximum of two int3 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 max(int3 x, int3 y) { return new int3(max(x.x, y.x), max(x.y, y.y), max(x.z, y.z)); }
-
- /// <summary>Returns the componentwise maximum of two int4 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 max(int4 x, int4 y) { return new int4(max(x.x, y.x), max(x.y, y.y), max(x.z, y.z), max(x.w, y.w)); }
-
-
- /// <summary>Returns the maximum of two uint values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint max(uint x, uint y) { return x > y ? x : y; }
-
- /// <summary>Returns the componentwise maximum of two uint2 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 max(uint2 x, uint2 y) { return new uint2(max(x.x, y.x), max(x.y, y.y)); }
-
- /// <summary>Returns the componentwise maximum of two uint3 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 max(uint3 x, uint3 y) { return new uint3(max(x.x, y.x), max(x.y, y.y), max(x.z, y.z)); }
-
- /// <summary>Returns the componentwise maximum of two uint4 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 max(uint4 x, uint4 y) { return new uint4(max(x.x, y.x), max(x.y, y.y), max(x.z, y.z), max(x.w, y.w)); }
-
-
- /// <summary>Returns the maximum of two long values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long max(long x, long y) { return x > y ? x : y; }
-
-
- /// <summary>Returns the maximum of two ulong values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong max(ulong x, ulong y) { return x > y ? x : y; }
-
-
- /// <summary>Returns the maximum of two float values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float max(float x, float y) { return float.IsNaN(y) || x > y ? x : y; }
-
- /// <summary>Returns the componentwise maximum of two float2 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 max(float2 x, float2 y) { return new float2(max(x.x, y.x), max(x.y, y.y)); }
-
- /// <summary>Returns the componentwise maximum of two float3 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 max(float3 x, float3 y) { return new float3(max(x.x, y.x), max(x.y, y.y), max(x.z, y.z)); }
-
- /// <summary>Returns the componentwise maximum of two float4 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 max(float4 x, float4 y) { return new float4(max(x.x, y.x), max(x.y, y.y), max(x.z, y.z), max(x.w, y.w)); }
-
-
- /// <summary>Returns the maximum of two double values.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double max(double x, double y) { return double.IsNaN(y) || x > y ? x : y; }
-
- /// <summary>Returns the componentwise maximum of two double2 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 max(double2 x, double2 y) { return new double2(max(x.x, y.x), max(x.y, y.y)); }
-
- /// <summary>Returns the componentwise maximum of two double3 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 max(double3 x, double3 y) { return new double3(max(x.x, y.x), max(x.y, y.y), max(x.z, y.z)); }
-
- /// <summary>Returns the componentwise maximum of two double4 vectors.</summary>
- /// <param name="x">The first input value.</param>
- /// <param name="y">The second input value.</param>
- /// <returns>The componentwise maximum of the two input values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 max(double4 x, double4 y) { return new double4(max(x.x, y.x), max(x.y, y.y), max(x.z, y.z), max(x.w, y.w)); }
-
-
- /// <summary>Returns the result of linearly interpolating from start to end using the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The interpolation from start to end.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float lerp(float start, float end, float t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 lerp(float2 start, float2 end, float t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 lerp(float3 start, float3 end, float t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 lerp(float4 start, float4 end, float t) { return start + t * (end - start); }
-
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 lerp(float2 start, float2 end, float2 t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 lerp(float3 start, float3 end, float3 t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 lerp(float4 start, float4 end, float4 t) { return start + t * (end - start); }
-
-
- /// <summary>Returns the result of linearly interpolating from x to y using the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double lerp(double start, double end, double t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 lerp(double2 start, double2 end, double t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 lerp(double3 start, double3 end, double t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 lerp(double4 start, double4 end, double t) { return start + t * (end - start); }
-
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 lerp(double2 start, double2 end, double2 t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 lerp(double3 start, double3 end, double3 t) { return start + t * (end - start); }
-
- /// <summary>Returns the result of a componentwise linear interpolating from x to y using the corresponding components of the interpolation parameter t.</summary>
- /// <remarks>
- /// If the interpolation parameter is not in the range [0, 1], then this function extrapolates.
- /// </remarks>
- /// <param name="start">The start point, corresponding to the interpolation parameter value of 0.</param>
- /// <param name="end">The end point, corresponding to the interpolation parameter value of 1.</param>
- /// <param name="t">The interpolation parameter. May be a value outside the interval [0, 1].</param>
- /// <returns>The componentwise interpolation from x to y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 lerp(double4 start, double4 end, double4 t) { return start + t * (end - start); }
-
-
- /// <summary>Returns the result of normalizing a floating point value x to a range [a, b]. The opposite of lerp. Equivalent to (x - a) / (b - a).</summary>
- /// <param name="start">The start point of the range.</param>
- /// <param name="end">The end point of the range.</param>
- /// <param name="x">The value to normalize to the range.</param>
- /// <returns>The interpolation parameter of x with respect to the input range [a, b].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float unlerp(float start, float end, float x) { return (x - start) / (end - start); }
-
- /// <summary>Returns the componentwise result of normalizing a floating point value x to a range [a, b]. The opposite of lerp. Equivalent to (x - a) / (b - a).</summary>
- /// <param name="start">The start point of the range.</param>
- /// <param name="end">The end point of the range.</param>
- /// <param name="x">The value to normalize to the range.</param>
- /// <returns>The componentwise interpolation parameter of x with respect to the input range [a, b].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 unlerp(float2 start, float2 end, float2 x) { return (x - start) / (end - start); }
-
- /// <summary>Returns the componentwise result of normalizing a floating point value x to a range [a, b]. The opposite of lerp. Equivalent to (x - a) / (b - a).</summary>
- /// <param name="start">The start point of the range.</param>
- /// <param name="end">The end point of the range.</param>
- /// <param name="x">The value to normalize to the range.</param>
- /// <returns>The componentwise interpolation parameter of x with respect to the input range [a, b].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 unlerp(float3 start, float3 end, float3 x) { return (x - start) / (end - start); }
-
- /// <summary>Returns the componentwise result of normalizing a floating point value x to a range [a, b]. The opposite of lerp. Equivalent to (x - a) / (b - a).</summary>
- /// <param name="start">The start point of the range.</param>
- /// <param name="end">The end point of the range.</param>
- /// <param name="x">The value to normalize to the range.</param>
- /// <returns>The componentwise interpolation parameter of x with respect to the input range [a, b].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 unlerp(float4 start, float4 end, float4 x) { return (x - start) / (end - start); }
-
-
- /// <summary>Returns the result of normalizing a floating point value x to a range [a, b]. The opposite of lerp. Equivalent to (x - a) / (b - a).</summary>
- /// <param name="start">The start point of the range.</param>
- /// <param name="end">The end point of the range.</param>
- /// <param name="x">The value to normalize to the range.</param>
- /// <returns>The interpolation parameter of x with respect to the input range [a, b].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double unlerp(double start, double end, double x) { return (x - start) / (end - start); }
-
- /// <summary>Returns the componentwise result of normalizing a floating point value x to a range [a, b]. The opposite of lerp. Equivalent to (x - a) / (b - a).</summary>
- /// <param name="start">The start point of the range.</param>
- /// <param name="end">The end point of the range.</param>
- /// <param name="x">The value to normalize to the range.</param>
- /// <returns>The componentwise interpolation parameter of x with respect to the input range [a, b].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 unlerp(double2 start, double2 end, double2 x) { return (x - start) / (end - start); }
-
- /// <summary>Returns the componentwise result of normalizing a floating point value x to a range [a, b]. The opposite of lerp. Equivalent to (x - a) / (b - a).</summary>
- /// <param name="start">The start point of the range.</param>
- /// <param name="end">The end point of the range.</param>
- /// <param name="x">The value to normalize to the range.</param>
- /// <returns>The componentwise interpolation parameter of x with respect to the input range [a, b].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 unlerp(double3 start, double3 end, double3 x) { return (x - start) / (end - start); }
-
- /// <summary>Returns the componentwise result of normalizing a floating point value x to a range [a, b]. The opposite of lerp. Equivalent to (x - a) / (b - a).</summary>
- /// <param name="start">The start point of the range.</param>
- /// <param name="end">The end point of the range.</param>
- /// <param name="x">The value to normalize to the range.</param>
- /// <returns>The componentwise interpolation parameter of x with respect to the input range [a, b].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 unlerp(double4 start, double4 end, double4 x) { return (x - start) / (end - start); }
-
-
- /// <summary>Returns the result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].</summary>
- /// <param name="srcStart">The start point of the source range [srcStart, srcEnd].</param>
- /// <param name="srcEnd">The end point of the source range [srcStart, srcEnd].</param>
- /// <param name="dstStart">The start point of the destination range [dstStart, dstEnd].</param>
- /// <param name="dstEnd">The end point of the destination range [dstStart, dstEnd].</param>
- /// <param name="x">The value to remap from the source to destination range.</param>
- /// <returns>The remap of input x from the source range to the destination range.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float remap(float srcStart, float srcEnd, float dstStart, float dstEnd, float x) { return lerp(dstStart, dstEnd, unlerp(srcStart, srcEnd, x)); }
-
- /// <summary>Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].</summary>
- /// <param name="srcStart">The start point of the source range [srcStart, srcEnd].</param>
- /// <param name="srcEnd">The end point of the source range [srcStart, srcEnd].</param>
- /// <param name="dstStart">The start point of the destination range [dstStart, dstEnd].</param>
- /// <param name="dstEnd">The end point of the destination range [dstStart, dstEnd].</param>
- /// <param name="x">The value to remap from the source to destination range.</param>
- /// <returns>The componentwise remap of input x from the source range to the destination range.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 remap(float2 srcStart, float2 srcEnd, float2 dstStart, float2 dstEnd, float2 x) { return lerp(dstStart, dstEnd, unlerp(srcStart, srcEnd, x)); }
-
- /// <summary>Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].</summary>
- /// <param name="srcStart">The start point of the source range [srcStart, srcEnd].</param>
- /// <param name="srcEnd">The end point of the source range [srcStart, srcEnd].</param>
- /// <param name="dstStart">The start point of the destination range [dstStart, dstEnd].</param>
- /// <param name="dstEnd">The end point of the destination range [dstStart, dstEnd].</param>
- /// <param name="x">The value to remap from the source to destination range.</param>
- /// <returns>The componentwise remap of input x from the source range to the destination range.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 remap(float3 srcStart, float3 srcEnd, float3 dstStart, float3 dstEnd, float3 x) { return lerp(dstStart, dstEnd, unlerp(srcStart, srcEnd, x)); }
-
- /// <summary>Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].</summary>
- /// <param name="srcStart">The start point of the source range [srcStart, srcEnd].</param>
- /// <param name="srcEnd">The end point of the source range [srcStart, srcEnd].</param>
- /// <param name="dstStart">The start point of the destination range [dstStart, dstEnd].</param>
- /// <param name="dstEnd">The end point of the destination range [dstStart, dstEnd].</param>
- /// <param name="x">The value to remap from the source to destination range.</param>
- /// <returns>The componentwise remap of input x from the source range to the destination range.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 remap(float4 srcStart, float4 srcEnd, float4 dstStart, float4 dstEnd, float4 x) { return lerp(dstStart, dstEnd, unlerp(srcStart, srcEnd, x)); }
-
-
- /// <summary>Returns the result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].</summary>
- /// <param name="srcStart">The start point of the source range [srcStart, srcEnd].</param>
- /// <param name="srcEnd">The end point of the source range [srcStart, srcEnd].</param>
- /// <param name="dstStart">The start point of the destination range [dstStart, dstEnd].</param>
- /// <param name="dstEnd">The end point of the destination range [dstStart, dstEnd].</param>
- /// <param name="x">The value to remap from the source to destination range.</param>
- /// <returns>The remap of input x from the source range to the destination range.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double remap(double srcStart, double srcEnd, double dstStart, double dstEnd, double x) { return lerp(dstStart, dstEnd, unlerp(srcStart, srcEnd, x)); }
-
- /// <summary>Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].</summary>
- /// <param name="srcStart">The start point of the source range [srcStart, srcEnd].</param>
- /// <param name="srcEnd">The end point of the source range [srcStart, srcEnd].</param>
- /// <param name="dstStart">The start point of the destination range [dstStart, dstEnd].</param>
- /// <param name="dstEnd">The end point of the destination range [dstStart, dstEnd].</param>
- /// <param name="x">The value to remap from the source to destination range.</param>
- /// <returns>The componentwise remap of input x from the source range to the destination range.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 remap(double2 srcStart, double2 srcEnd, double2 dstStart, double2 dstEnd, double2 x) { return lerp(dstStart, dstEnd, unlerp(srcStart, srcEnd, x)); }
-
- /// <summary>Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].</summary>
- /// <param name="srcStart">The start point of the source range [srcStart, srcEnd].</param>
- /// <param name="srcEnd">The end point of the source range [srcStart, srcEnd].</param>
- /// <param name="dstStart">The start point of the destination range [dstStart, dstEnd].</param>
- /// <param name="dstEnd">The end point of the destination range [dstStart, dstEnd].</param>
- /// <param name="x">The value to remap from the source to destination range.</param>
- /// <returns>The componentwise remap of input x from the source range to the destination range.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 remap(double3 srcStart, double3 srcEnd, double3 dstStart, double3 dstEnd, double3 x) { return lerp(dstStart, dstEnd, unlerp(srcStart, srcEnd, x)); }
-
- /// <summary>Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].</summary>
- /// <param name="srcStart">The start point of the source range [srcStart, srcEnd].</param>
- /// <param name="srcEnd">The end point of the source range [srcStart, srcEnd].</param>
- /// <param name="dstStart">The start point of the destination range [dstStart, dstEnd].</param>
- /// <param name="dstEnd">The end point of the destination range [dstStart, dstEnd].</param>
- /// <param name="x">The value to remap from the source to destination range.</param>
- /// <returns>The componentwise remap of input x from the source range to the destination range.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 remap(double4 srcStart, double4 srcEnd, double4 dstStart, double4 dstEnd, double4 x) { return lerp(dstStart, dstEnd, unlerp(srcStart, srcEnd, x)); }
-
-
- /// <summary>Returns the result of a multiply-add operation (a * b + c) on 3 int values.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int mad(int mulA, int mulB, int addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 int2 vectors.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 mad(int2 mulA, int2 mulB, int2 addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 int3 vectors.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 mad(int3 mulA, int3 mulB, int3 addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 int4 vectors.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 mad(int4 mulA, int4 mulB, int4 addC) { return mulA * mulB + addC; }
-
-
- /// <summary>Returns the result of a multiply-add operation (a * b + c) on 3 uint values.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint mad(uint mulA, uint mulB, uint addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 uint2 vectors.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 mad(uint2 mulA, uint2 mulB, uint2 addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 uint3 vectors.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 mad(uint3 mulA, uint3 mulB, uint3 addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 uint4 vectors.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 mad(uint4 mulA, uint4 mulB, uint4 addC) { return mulA * mulB + addC; }
-
-
- /// <summary>Returns the result of a multiply-add operation (a * b + c) on 3 long values.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long mad(long mulA, long mulB, long addC) { return mulA * mulB + addC; }
-
-
- /// <summary>Returns the result of a multiply-add operation (a * b + c) on 3 ulong values.</summary>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong mad(ulong mulA, ulong mulB, ulong addC) { return mulA * mulB + addC; }
-
-
- /// <summary>Returns the result of a multiply-add operation (a * b + c) on 3 float values.</summary>
- /// <remarks>
- /// When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA).
- /// FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when
- /// this computation is not fused.
- /// </remarks>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float mad(float mulA, float mulB, float addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 float2 vectors.</summary>
- /// <remarks>
- /// When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA).
- /// FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when
- /// this computation is not fused.
- /// </remarks>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 mad(float2 mulA, float2 mulB, float2 addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 float3 vectors.</summary>
- /// <remarks>
- /// When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA).
- /// FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when
- /// this computation is not fused.
- /// </remarks>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 mad(float3 mulA, float3 mulB, float3 addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 float4 vectors.</summary>
- /// <remarks>
- /// When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA).
- /// FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when
- /// this computation is not fused.
- /// </remarks>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 mad(float4 mulA, float4 mulB, float4 addC) { return mulA * mulB + addC; }
-
-
- /// <summary>Returns the result of a multiply-add operation (a * b + c) on 3 double values.</summary>
- /// <remarks>
- /// When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA).
- /// FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when
- /// this computation is not fused.
- /// </remarks>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double mad(double mulA, double mulB, double addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 double2 vectors.</summary>
- /// <remarks>
- /// When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA).
- /// FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when
- /// this computation is not fused.
- /// </remarks>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 mad(double2 mulA, double2 mulB, double2 addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 double3 vectors.</summary>
- /// <remarks>
- /// When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA).
- /// FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when
- /// this computation is not fused.
- /// </remarks>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 mad(double3 mulA, double3 mulB, double3 addC) { return mulA * mulB + addC; }
-
- /// <summary>Returns the result of a componentwise multiply-add operation (a * b + c) on 3 double4 vectors.</summary>
- /// <remarks>
- /// When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA).
- /// FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when
- /// this computation is not fused.
- /// </remarks>
- /// <param name="mulA">First value to multiply.</param>
- /// <param name="mulB">Second value to multiply.</param>
- /// <param name="addC">Third value to add to the product of a and b.</param>
- /// <returns>The componentwise multiply-add of the inputs.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 mad(double4 mulA, double4 mulB, double4 addC) { return mulA * mulB + addC; }
-
-
- /// <summary>Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are int values.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int clamp(int valueToClamp, int lowerBound, int upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the int2 x into the interval [a, b], where a and b are int2 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 clamp(int2 valueToClamp, int2 lowerBound, int2 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the int3 x into the interval [a, b], where x, a and b are int3 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 clamp(int3 valueToClamp, int3 lowerBound, int3 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are int4 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 clamp(int4 valueToClamp, int4 lowerBound, int4 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
-
- /// <summary>Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint values.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint clamp(uint valueToClamp, uint lowerBound, uint upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint2 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 clamp(uint2 valueToClamp, uint2 lowerBound, uint2 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint3 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 clamp(uint3 valueToClamp, uint3 lowerBound, uint3 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint4 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 clamp(uint4 valueToClamp, uint4 lowerBound, uint4 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
-
- /// <summary>Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are long values.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long clamp(long valueToClamp, long lowerBound, long upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are ulong values.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong clamp(ulong valueToClamp, ulong lowerBound, ulong upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
-
- /// <summary>Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float values.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float clamp(float valueToClamp, float lowerBound, float upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float2 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 clamp(float2 valueToClamp, float2 lowerBound, float2 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float3 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 clamp(float3 valueToClamp, float3 lowerBound, float3 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float4 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 clamp(float4 valueToClamp, float4 lowerBound, float4 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
-
- /// <summary>Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double values.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double clamp(double valueToClamp, double lowerBound, double upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double2 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 clamp(double2 valueToClamp, double2 lowerBound, double2 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double3 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 clamp(double3 valueToClamp, double3 lowerBound, double3 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
- /// <summary>Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double4 vectors.</summary>
- /// <param name="valueToClamp">Input value to be clamped.</param>
- /// <param name="lowerBound">Lower bound of the interval.</param>
- /// <param name="upperBound">Upper bound of the interval.</param>
- /// <returns>The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 clamp(double4 valueToClamp, double4 lowerBound, double4 upperBound) { return max(lowerBound, min(upperBound, valueToClamp)); }
-
-
- /// <summary>Returns the result of clamping the float value x into the interval [0, 1].</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The clamping of the input into the interval [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float saturate(float x) { return clamp(x, 0.0f, 1.0f); }
-
- /// <summary>Returns the result of a componentwise clamping of the float2 vector x into the interval [0, 1].</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise clamping of the input into the interval [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 saturate(float2 x) { return clamp(x, new float2(0.0f), new float2(1.0f)); }
-
- /// <summary>Returns the result of a componentwise clamping of the float3 vector x into the interval [0, 1].</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise clamping of the input into the interval [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 saturate(float3 x) { return clamp(x, new float3(0.0f), new float3(1.0f)); }
-
- /// <summary>Returns the result of a componentwise clamping of the float4 vector x into the interval [0, 1].</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise clamping of the input into the interval [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 saturate(float4 x) { return clamp(x, new float4(0.0f), new float4(1.0f)); }
-
-
- /// <summary>Returns the result of clamping the double value x into the interval [0, 1].</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The clamping of the input into the interval [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double saturate(double x) { return clamp(x, 0.0, 1.0); }
-
- /// <summary>Returns the result of a componentwise clamping of the double2 vector x into the interval [0, 1].</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise clamping of the input into the interval [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 saturate(double2 x) { return clamp(x, new double2(0.0), new double2(1.0)); }
-
- /// <summary>Returns the result of a componentwise clamping of the double3 vector x into the interval [0, 1].</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise clamping of the input into the interval [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 saturate(double3 x) { return clamp(x, new double3(0.0), new double3(1.0)); }
-
- /// <summary>Returns the result of a componentwise clamping of the double4 vector x into the interval [0, 1].</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise clamping of the input into the interval [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 saturate(double4 x) { return clamp(x, new double4(0.0), new double4(1.0)); }
-
-
- /// <summary>Returns the absolute value of a int value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int abs(int x) { return max(-x, x); }
-
- /// <summary>Returns the componentwise absolute value of a int2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 abs(int2 x) { return max(-x, x); }
-
- /// <summary>Returns the componentwise absolute value of a int3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 abs(int3 x) { return max(-x, x); }
-
- /// <summary>Returns the componentwise absolute value of a int4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 abs(int4 x) { return max(-x, x); }
-
- /// <summary>Returns the absolute value of a long value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long abs(long x) { return max(-x, x); }
-
-
- /// <summary>Returns the absolute value of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float abs(float x) { return asfloat(asuint(x) & 0x7FFFFFFF); }
-
- /// <summary>Returns the componentwise absolute value of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 abs(float2 x) { return asfloat(asuint(x) & 0x7FFFFFFF); }
-
- /// <summary>Returns the componentwise absolute value of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 abs(float3 x) { return asfloat(asuint(x) & 0x7FFFFFFF); }
-
- /// <summary>Returns the componentwise absolute value of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 abs(float4 x) { return asfloat(asuint(x) & 0x7FFFFFFF); }
-
-
- /// <summary>Returns the absolute value of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double abs(double x) { return asdouble(asulong(x) & 0x7FFFFFFFFFFFFFFF); }
-
- /// <summary>Returns the componentwise absolute value of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 abs(double2 x) { return double2(asdouble(asulong(x.x) & 0x7FFFFFFFFFFFFFFF), asdouble(asulong(x.y) & 0x7FFFFFFFFFFFFFFF)); }
-
- /// <summary>Returns the componentwise absolute value of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 abs(double3 x) { return double3(asdouble(asulong(x.x) & 0x7FFFFFFFFFFFFFFF), asdouble(asulong(x.y) & 0x7FFFFFFFFFFFFFFF), asdouble(asulong(x.z) & 0x7FFFFFFFFFFFFFFF)); }
-
- /// <summary>Returns the componentwise absolute value of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise absolute value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 abs(double4 x) { return double4(asdouble(asulong(x.x) & 0x7FFFFFFFFFFFFFFF), asdouble(asulong(x.y) & 0x7FFFFFFFFFFFFFFF), asdouble(asulong(x.z) & 0x7FFFFFFFFFFFFFFF), asdouble(asulong(x.w) & 0x7FFFFFFFFFFFFFFF)); }
-
-
- /// <summary>Returns the dot product of two int values. Equivalent to multiplication.</summary>
- /// <param name="x">The first value.</param>
- /// <param name="y">The second value.</param>
- /// <returns>The dot product of two values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int dot(int x, int y) { return x * y; }
-
- /// <summary>Returns the dot product of two int2 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int dot(int2 x, int2 y) { return x.x * y.x + x.y * y.y; }
-
- /// <summary>Returns the dot product of two int3 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int dot(int3 x, int3 y) { return x.x * y.x + x.y * y.y + x.z * y.z; }
-
- /// <summary>Returns the dot product of two int4 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int dot(int4 x, int4 y) { return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; }
-
-
- /// <summary>Returns the dot product of two uint values. Equivalent to multiplication.</summary>
- /// <param name="x">The first value.</param>
- /// <param name="y">The second value.</param>
- /// <returns>The dot product of two values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint dot(uint x, uint y) { return x * y; }
-
- /// <summary>Returns the dot product of two uint2 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint dot(uint2 x, uint2 y) { return x.x * y.x + x.y * y.y; }
-
- /// <summary>Returns the dot product of two uint3 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint dot(uint3 x, uint3 y) { return x.x * y.x + x.y * y.y + x.z * y.z; }
-
- /// <summary>Returns the dot product of two uint4 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint dot(uint4 x, uint4 y) { return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; }
-
-
- /// <summary>Returns the dot product of two float values. Equivalent to multiplication.</summary>
- /// <param name="x">The first value.</param>
- /// <param name="y">The second value.</param>
- /// <returns>The dot product of two values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float dot(float x, float y) { return x * y; }
-
- /// <summary>Returns the dot product of two float2 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float dot(float2 x, float2 y) { return x.x * y.x + x.y * y.y; }
-
- /// <summary>Returns the dot product of two float3 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float dot(float3 x, float3 y) { return x.x * y.x + x.y * y.y + x.z * y.z; }
-
- /// <summary>Returns the dot product of two float4 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float dot(float4 x, float4 y) { return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; }
-
-
- /// <summary>Returns the dot product of two double values. Equivalent to multiplication.</summary>
- /// <param name="x">The first value.</param>
- /// <param name="y">The second value.</param>
- /// <returns>The dot product of two values.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double dot(double x, double y) { return x * y; }
-
- /// <summary>Returns the dot product of two double2 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double dot(double2 x, double2 y) { return x.x * y.x + x.y * y.y; }
-
- /// <summary>Returns the dot product of two double3 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double dot(double3 x, double3 y) { return x.x * y.x + x.y * y.y + x.z * y.z; }
-
- /// <summary>Returns the dot product of two double4 vectors.</summary>
- /// <param name="x">The first vector.</param>
- /// <param name="y">The second vector.</param>
- /// <returns>The dot product of two vectors.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double dot(double4 x, double4 y) { return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; }
-
-
- /// <summary>Returns the tangent of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float tan(float x) { return (float)System.Math.Tan(x); }
-
- /// <summary>Returns the componentwise tangent of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 tan(float2 x) { return new float2(tan(x.x), tan(x.y)); }
-
- /// <summary>Returns the componentwise tangent of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 tan(float3 x) { return new float3(tan(x.x), tan(x.y), tan(x.z)); }
-
- /// <summary>Returns the componentwise tangent of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 tan(float4 x) { return new float4(tan(x.x), tan(x.y), tan(x.z), tan(x.w)); }
-
-
- /// <summary>Returns the tangent of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double tan(double x) { return System.Math.Tan(x); }
-
- /// <summary>Returns the componentwise tangent of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 tan(double2 x) { return new double2(tan(x.x), tan(x.y)); }
-
- /// <summary>Returns the componentwise tangent of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 tan(double3 x) { return new double3(tan(x.x), tan(x.y), tan(x.z)); }
-
- /// <summary>Returns the componentwise tangent of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 tan(double4 x) { return new double4(tan(x.x), tan(x.y), tan(x.z), tan(x.w)); }
-
-
- /// <summary>Returns the hyperbolic tangent of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The hyperbolic tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float tanh(float x) { return (float)System.Math.Tanh(x); }
-
- /// <summary>Returns the componentwise hyperbolic tangent of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 tanh(float2 x) { return new float2(tanh(x.x), tanh(x.y)); }
-
- /// <summary>Returns the componentwise hyperbolic tangent of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 tanh(float3 x) { return new float3(tanh(x.x), tanh(x.y), tanh(x.z)); }
-
- /// <summary>Returns the componentwise hyperbolic tangent of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 tanh(float4 x) { return new float4(tanh(x.x), tanh(x.y), tanh(x.z), tanh(x.w)); }
-
-
- /// <summary>Returns the hyperbolic tangent of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The hyperbolic tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double tanh(double x) { return System.Math.Tanh(x); }
-
- /// <summary>Returns the componentwise hyperbolic tangent of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 tanh(double2 x) { return new double2(tanh(x.x), tanh(x.y)); }
-
- /// <summary>Returns the componentwise hyperbolic tangent of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 tanh(double3 x) { return new double3(tanh(x.x), tanh(x.y), tanh(x.z)); }
-
- /// <summary>Returns the componentwise hyperbolic tangent of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic tangent of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 tanh(double4 x) { return new double4(tanh(x.x), tanh(x.y), tanh(x.z), tanh(x.w)); }
-
-
- /// <summary>Returns the arctangent of a float value.</summary>
- /// <param name="x">A tangent value, usually the ratio y/x on the unit circle.</param>
- /// <returns>The arctangent of the input, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float atan(float x) { return (float)System.Math.Atan(x); }
-
- /// <summary>Returns the componentwise arctangent of a float2 vector.</summary>
- /// <param name="x">A tangent value, usually the ratio y/x on the unit circle.</param>
- /// <returns>The componentwise arctangent of the input, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 atan(float2 x) { return new float2(atan(x.x), atan(x.y)); }
-
- /// <summary>Returns the componentwise arctangent of a float3 vector.</summary>
- /// <param name="x">A tangent value, usually the ratio y/x on the unit circle.</param>
- /// <returns>The componentwise arctangent of the input, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 atan(float3 x) { return new float3(atan(x.x), atan(x.y), atan(x.z)); }
-
- /// <summary>Returns the componentwise arctangent of a float4 vector.</summary>
- /// <param name="x">A tangent value, usually the ratio y/x on the unit circle.</param>
- /// <returns>The componentwise arctangent of the input, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 atan(float4 x) { return new float4(atan(x.x), atan(x.y), atan(x.z), atan(x.w)); }
-
-
- /// <summary>Returns the arctangent of a double value.</summary>
- /// <param name="x">A tangent value, usually the ratio y/x on the unit circle.</param>
- /// <returns>The arctangent of the input, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double atan(double x) { return System.Math.Atan(x); }
-
- /// <summary>Returns the componentwise arctangent of a double2 vector.</summary>
- /// <param name="x">A tangent value, usually the ratio y/x on the unit circle.</param>
- /// <returns>The componentwise arctangent of the input, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 atan(double2 x) { return new double2(atan(x.x), atan(x.y)); }
-
- /// <summary>Returns the componentwise arctangent of a double3 vector.</summary>
- /// <param name="x">A tangent value, usually the ratio y/x on the unit circle.</param>
- /// <returns>The componentwise arctangent of the input, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 atan(double3 x) { return new double3(atan(x.x), atan(x.y), atan(x.z)); }
-
- /// <summary>Returns the componentwise arctangent of a double4 vector.</summary>
- /// <param name="x">A tangent value, usually the ratio y/x on the unit circle.</param>
- /// <returns>The componentwise arctangent of the input, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 atan(double4 x) { return new double4(atan(x.x), atan(x.y), atan(x.z), atan(x.w)); }
-
-
- /// <summary>Returns the 2-argument arctangent of a pair of float values.</summary>
- /// <param name="y">Numerator of the ratio y/x, usually the y component on the unit circle.</param>
- /// <param name="x">Denominator of the ratio y/x, usually the x component on the unit circle.</param>
- /// <returns>The arctangent of the ratio y/x, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float atan2(float y, float x) { return (float)System.Math.Atan2(y, x); }
-
- /// <summary>Returns the componentwise 2-argument arctangent of a pair of floats2 vectors.</summary>
- /// <param name="y">Numerator of the ratio y/x, usually the y component on the unit circle.</param>
- /// <param name="x">Denominator of the ratio y/x, usually the x component on the unit circle.</param>
- /// <returns>The componentwise arctangent of the ratio y/x, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 atan2(float2 y, float2 x) { return new float2(atan2(y.x, x.x), atan2(y.y, x.y)); }
-
- /// <summary>Returns the componentwise 2-argument arctangent of a pair of floats3 vectors.</summary>
- /// <param name="y">Numerator of the ratio y/x, usually the y component on the unit circle.</param>
- /// <param name="x">Denominator of the ratio y/x, usually the x component on the unit circle.</param>
- /// <returns>The componentwise arctangent of the ratio y/x, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 atan2(float3 y, float3 x) { return new float3(atan2(y.x, x.x), atan2(y.y, x.y), atan2(y.z, x.z)); }
-
- /// <summary>Returns the componentwise 2-argument arctangent of a pair of floats4 vectors.</summary>
- /// <param name="y">Numerator of the ratio y/x, usually the y component on the unit circle.</param>
- /// <param name="x">Denominator of the ratio y/x, usually the x component on the unit circle.</param>
- /// <returns>The componentwise arctangent of the ratio y/x, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 atan2(float4 y, float4 x) { return new float4(atan2(y.x, x.x), atan2(y.y, x.y), atan2(y.z, x.z), atan2(y.w, x.w)); }
-
-
- /// <summary>Returns the 2-argument arctangent of a pair of double values.</summary>
- /// <param name="y">Numerator of the ratio y/x, usually the y component on the unit circle.</param>
- /// <param name="x">Denominator of the ratio y/x, usually the x component on the unit circle.</param>
- /// <returns>The arctangent of the ratio y/x, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double atan2(double y, double x) { return System.Math.Atan2(y, x); }
-
- /// <summary>Returns the 2-argument arctangent of a pair of double2 vectors.</summary>
- /// <param name="y">Numerator of the ratio y/x, usually the y component on the unit circle.</param>
- /// <param name="x">Denominator of the ratio y/x, usually the x component on the unit circle.</param>
- /// <returns>The componentwise arctangent of the ratio y/x, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 atan2(double2 y, double2 x) { return new double2(atan2(y.x, x.x), atan2(y.y, x.y)); }
-
- /// <summary>Returns the 2-argument arctangent of a pair of double3 vectors.</summary>
- /// <param name="y">Numerator of the ratio y/x, usually the y component on the unit circle.</param>
- /// <param name="x">Denominator of the ratio y/x, usually the x component on the unit circle.</param>
- /// <returns>The componentwise arctangent of the ratio y/x, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 atan2(double3 y, double3 x) { return new double3(atan2(y.x, x.x), atan2(y.y, x.y), atan2(y.z, x.z)); }
-
- /// <summary>Returns the 2-argument arctangent of a pair of double4 vectors.</summary>
- /// <param name="y">Numerator of the ratio y/x, usually the y component on the unit circle.</param>
- /// <param name="x">Denominator of the ratio y/x, usually the x component on the unit circle.</param>
- /// <returns>The componentwise arctangent of the ratio y/x, in radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 atan2(double4 y, double4 x) { return new double4(atan2(y.x, x.x), atan2(y.y, x.y), atan2(y.z, x.z), atan2(y.w, x.w)); }
-
-
- /// <summary>Returns the cosine of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The cosine cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float cos(float x) { return (float)System.Math.Cos(x); }
-
- /// <summary>Returns the componentwise cosine of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise cosine cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 cos(float2 x) { return new float2(cos(x.x), cos(x.y)); }
-
- /// <summary>Returns the componentwise cosine of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise cosine cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 cos(float3 x) { return new float3(cos(x.x), cos(x.y), cos(x.z)); }
-
- /// <summary>Returns the componentwise cosine of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise cosine cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 cos(float4 x) { return new float4(cos(x.x), cos(x.y), cos(x.z), cos(x.w)); }
-
-
- /// <summary>Returns the cosine of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The cosine cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double cos(double x) { return System.Math.Cos(x); }
-
- /// <summary>Returns the componentwise cosine of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise cosine cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 cos(double2 x) { return new double2(cos(x.x), cos(x.y)); }
-
- /// <summary>Returns the componentwise cosine of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise cosine cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 cos(double3 x) { return new double3(cos(x.x), cos(x.y), cos(x.z)); }
-
- /// <summary>Returns the componentwise cosine of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise cosine cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 cos(double4 x) { return new double4(cos(x.x), cos(x.y), cos(x.z), cos(x.w)); }
-
-
- /// <summary>Returns the hyperbolic cosine of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The hyperbolic cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float cosh(float x) { return (float)System.Math.Cosh(x); }
-
- /// <summary>Returns the componentwise hyperbolic cosine of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 cosh(float2 x) { return new float2(cosh(x.x), cosh(x.y)); }
-
- /// <summary>Returns the componentwise hyperbolic cosine of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 cosh(float3 x) { return new float3(cosh(x.x), cosh(x.y), cosh(x.z)); }
-
- /// <summary>Returns the componentwise hyperbolic cosine of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 cosh(float4 x) { return new float4(cosh(x.x), cosh(x.y), cosh(x.z), cosh(x.w)); }
-
-
- /// <summary>Returns the hyperbolic cosine of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The hyperbolic cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double cosh(double x) { return System.Math.Cosh(x); }
-
- /// <summary>Returns the componentwise hyperbolic cosine of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 cosh(double2 x) { return new double2(cosh(x.x), cosh(x.y)); }
-
- /// <summary>Returns the componentwise hyperbolic cosine of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 cosh(double3 x) { return new double3(cosh(x.x), cosh(x.y), cosh(x.z)); }
-
- /// <summary>Returns the componentwise hyperbolic cosine of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic cosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 cosh(double4 x) { return new double4(cosh(x.x), cosh(x.y), cosh(x.z), cosh(x.w)); }
-
-
- /// <summary>Returns the arccosine of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The arccosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float acos(float x) { return (float)System.Math.Acos((float)x); }
-
- /// <summary>Returns the componentwise arccosine of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arccosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 acos(float2 x) { return new float2(acos(x.x), acos(x.y)); }
-
- /// <summary>Returns the componentwise arccosine of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arccosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 acos(float3 x) { return new float3(acos(x.x), acos(x.y), acos(x.z)); }
-
- /// <summary>Returns the componentwise arccosine of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arccosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 acos(float4 x) { return new float4(acos(x.x), acos(x.y), acos(x.z), acos(x.w)); }
-
-
- /// <summary>Returns the arccosine of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The arccosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double acos(double x) { return System.Math.Acos(x); }
-
- /// <summary>Returns the componentwise arccosine of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arccosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 acos(double2 x) { return new double2(acos(x.x), acos(x.y)); }
-
- /// <summary>Returns the componentwise arccosine of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arccosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 acos(double3 x) { return new double3(acos(x.x), acos(x.y), acos(x.z)); }
-
- /// <summary>Returns the componentwise arccosine of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arccosine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 acos(double4 x) { return new double4(acos(x.x), acos(x.y), acos(x.z), acos(x.w)); }
-
-
- /// <summary>Returns the sine of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float sin(float x) { return (float)System.Math.Sin((float)x); }
-
- /// <summary>Returns the componentwise sine of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 sin(float2 x) { return new float2(sin(x.x), sin(x.y)); }
-
- /// <summary>Returns the componentwise sine of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 sin(float3 x) { return new float3(sin(x.x), sin(x.y), sin(x.z)); }
-
- /// <summary>Returns the componentwise sine of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 sin(float4 x) { return new float4(sin(x.x), sin(x.y), sin(x.z), sin(x.w)); }
-
-
- /// <summary>Returns the sine of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double sin(double x) { return System.Math.Sin(x); }
-
- /// <summary>Returns the componentwise sine of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 sin(double2 x) { return new double2(sin(x.x), sin(x.y)); }
-
- /// <summary>Returns the componentwise sine of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 sin(double3 x) { return new double3(sin(x.x), sin(x.y), sin(x.z)); }
-
- /// <summary>Returns the componentwise sine of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 sin(double4 x) { return new double4(sin(x.x), sin(x.y), sin(x.z), sin(x.w)); }
-
-
- /// <summary>Returns the hyperbolic sine of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The hyperbolic sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float sinh(float x) { return (float)System.Math.Sinh((float)x); }
-
- /// <summary>Returns the componentwise hyperbolic sine of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 sinh(float2 x) { return new float2(sinh(x.x), sinh(x.y)); }
-
- /// <summary>Returns the componentwise hyperbolic sine of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 sinh(float3 x) { return new float3(sinh(x.x), sinh(x.y), sinh(x.z)); }
-
- /// <summary>Returns the componentwise hyperbolic sine of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 sinh(float4 x) { return new float4(sinh(x.x), sinh(x.y), sinh(x.z), sinh(x.w)); }
-
-
- /// <summary>Returns the hyperbolic sine of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The hyperbolic sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double sinh(double x) { return System.Math.Sinh(x); }
-
- /// <summary>Returns the componentwise hyperbolic sine of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 sinh(double2 x) { return new double2(sinh(x.x), sinh(x.y)); }
-
- /// <summary>Returns the componentwise hyperbolic sine of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 sinh(double3 x) { return new double3(sinh(x.x), sinh(x.y), sinh(x.z)); }
-
- /// <summary>Returns the componentwise hyperbolic sine of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise hyperbolic sine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 sinh(double4 x) { return new double4(sinh(x.x), sinh(x.y), sinh(x.z), sinh(x.w)); }
-
-
- /// <summary>Returns the arcsine of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The arcsine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float asin(float x) { return (float)System.Math.Asin((float)x); }
-
- /// <summary>Returns the componentwise arcsine of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arcsine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 asin(float2 x) { return new float2(asin(x.x), asin(x.y)); }
-
- /// <summary>Returns the componentwise arcsine of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arcsine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 asin(float3 x) { return new float3(asin(x.x), asin(x.y), asin(x.z)); }
-
- /// <summary>Returns the componentwise arcsine of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arcsine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 asin(float4 x) { return new float4(asin(x.x), asin(x.y), asin(x.z), asin(x.w)); }
-
-
- /// <summary>Returns the arcsine of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The arcsine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double asin(double x) { return System.Math.Asin(x); }
-
- /// <summary>Returns the componentwise arcsine of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arcsine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 asin(double2 x) { return new double2(asin(x.x), asin(x.y)); }
-
- /// <summary>Returns the componentwise arcsine of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arcsine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 asin(double3 x) { return new double3(asin(x.x), asin(x.y), asin(x.z)); }
-
- /// <summary>Returns the componentwise arcsine of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise arcsine of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 asin(double4 x) { return new double4(asin(x.x), asin(x.y), asin(x.z), asin(x.w)); }
-
-
- /// <summary>Returns the result of rounding a float value up to the nearest integral value less or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The round down to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float floor(float x) { return (float)System.Math.Floor((float)x); }
-
- /// <summary>Returns the result of rounding each component of a float2 vector value down to the nearest value less or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round down to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 floor(float2 x) { return new float2(floor(x.x), floor(x.y)); }
-
- /// <summary>Returns the result of rounding each component of a float3 vector value down to the nearest value less or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round down to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 floor(float3 x) { return new float3(floor(x.x), floor(x.y), floor(x.z)); }
-
- /// <summary>Returns the result of rounding each component of a float4 vector value down to the nearest value less or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round down to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 floor(float4 x) { return new float4(floor(x.x), floor(x.y), floor(x.z), floor(x.w)); }
-
-
- /// <summary>Returns the result of rounding a double value up to the nearest integral value less or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The round down to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double floor(double x) { return System.Math.Floor(x); }
-
- /// <summary>Returns the result of rounding each component of a double2 vector value down to the nearest value less or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round down to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 floor(double2 x) { return new double2(floor(x.x), floor(x.y)); }
-
- /// <summary>Returns the result of rounding each component of a double3 vector value down to the nearest value less or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round down to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 floor(double3 x) { return new double3(floor(x.x), floor(x.y), floor(x.z)); }
-
- /// <summary>Returns the result of rounding each component of a double4 vector value down to the nearest value less or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round down to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 floor(double4 x) { return new double4(floor(x.x), floor(x.y), floor(x.z), floor(x.w)); }
-
-
- /// <summary>Returns the result of rounding a float value up to the nearest integral value greater or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The round up to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float ceil(float x) { return (float)System.Math.Ceiling((float)x); }
-
- /// <summary>Returns the result of rounding each component of a float2 vector value up to the nearest value greater or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round up to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 ceil(float2 x) { return new float2(ceil(x.x), ceil(x.y)); }
-
- /// <summary>Returns the result of rounding each component of a float3 vector value up to the nearest value greater or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round up to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 ceil(float3 x) { return new float3(ceil(x.x), ceil(x.y), ceil(x.z)); }
-
- /// <summary>Returns the result of rounding each component of a float4 vector value up to the nearest value greater or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round up to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 ceil(float4 x) { return new float4(ceil(x.x), ceil(x.y), ceil(x.z), ceil(x.w)); }
-
-
- /// <summary>Returns the result of rounding a double value up to the nearest greater integral value greater or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The round up to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double ceil(double x) { return System.Math.Ceiling(x); }
-
- /// <summary>Returns the result of rounding each component of a double2 vector value up to the nearest integral value greater or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round up to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 ceil(double2 x) { return new double2(ceil(x.x), ceil(x.y)); }
-
- /// <summary>Returns the result of rounding each component of a double3 vector value up to the nearest integral value greater or equal to the original value..</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round up to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 ceil(double3 x) { return new double3(ceil(x.x), ceil(x.y), ceil(x.z)); }
-
- /// <summary>Returns the result of rounding each component of a double4 vector value up to the nearest integral value greater or equal to the original value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round up to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 ceil(double4 x) { return new double4(ceil(x.x), ceil(x.y), ceil(x.z), ceil(x.w)); }
-
-
- /// <summary>Returns the result of rounding a float value to the nearest integral value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The round to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float round(float x) { return (float)System.Math.Round((float)x); }
-
- /// <summary>Returns the result of rounding each component of a float2 vector value to the nearest integral value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 round(float2 x) { return new float2(round(x.x), round(x.y)); }
-
- /// <summary>Returns the result of rounding each component of a float3 vector value to the nearest integral value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 round(float3 x) { return new float3(round(x.x), round(x.y), round(x.z)); }
-
- /// <summary>Returns the result of rounding each component of a float4 vector value to the nearest integral value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 round(float4 x) { return new float4(round(x.x), round(x.y), round(x.z), round(x.w)); }
-
-
- /// <summary>Returns the result of rounding a double value to the nearest integral value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The round to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double round(double x) { return System.Math.Round(x); }
-
- /// <summary>Returns the result of rounding each component of a double2 vector value to the nearest integral value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 round(double2 x) { return new double2(round(x.x), round(x.y)); }
-
- /// <summary>Returns the result of rounding each component of a double3 vector value to the nearest integral value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 round(double3 x) { return new double3(round(x.x), round(x.y), round(x.z)); }
-
- /// <summary>Returns the result of rounding each component of a double4 vector value to the nearest integral value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise round to nearest integral value of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 round(double4 x) { return new double4(round(x.x), round(x.y), round(x.z), round(x.w)); }
-
-
- /// <summary>Returns the result of truncating a float value to an integral float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The truncation of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float trunc(float x) { return (float)System.Math.Truncate((float)x); }
-
- /// <summary>Returns the result of a componentwise truncation of a float2 value to an integral float2 value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise truncation of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 trunc(float2 x) { return new float2(trunc(x.x), trunc(x.y)); }
-
- /// <summary>Returns the result of a componentwise truncation of a float3 value to an integral float3 value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise truncation of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 trunc(float3 x) { return new float3(trunc(x.x), trunc(x.y), trunc(x.z)); }
-
- /// <summary>Returns the result of a componentwise truncation of a float4 value to an integral float4 value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise truncation of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 trunc(float4 x) { return new float4(trunc(x.x), trunc(x.y), trunc(x.z), trunc(x.w)); }
-
-
- /// <summary>Returns the result of truncating a double value to an integral double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The truncation of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double trunc(double x) { return System.Math.Truncate(x); }
-
- /// <summary>Returns the result of a componentwise truncation of a double2 value to an integral double2 value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise truncation of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 trunc(double2 x) { return new double2(trunc(x.x), trunc(x.y)); }
-
- /// <summary>Returns the result of a componentwise truncation of a double3 value to an integral double3 value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise truncation of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 trunc(double3 x) { return new double3(trunc(x.x), trunc(x.y), trunc(x.z)); }
-
- /// <summary>Returns the result of a componentwise truncation of a double4 value to an integral double4 value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise truncation of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 trunc(double4 x) { return new double4(trunc(x.x), trunc(x.y), trunc(x.z), trunc(x.w)); }
-
-
- /// <summary>Returns the fractional part of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The fractional part of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float frac(float x) { return x - floor(x); }
-
- /// <summary>Returns the componentwise fractional parts of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise fractional part of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 frac(float2 x) { return x - floor(x); }
-
- /// <summary>Returns the componentwise fractional parts of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise fractional part of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 frac(float3 x) { return x - floor(x); }
-
- /// <summary>Returns the componentwise fractional parts of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise fractional part of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 frac(float4 x) { return x - floor(x); }
-
-
- /// <summary>Returns the fractional part of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The fractional part of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double frac(double x) { return x - floor(x); }
-
- /// <summary>Returns the componentwise fractional parts of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise fractional part of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 frac(double2 x) { return x - floor(x); }
-
- /// <summary>Returns the componentwise fractional parts of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise fractional part of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 frac(double3 x) { return x - floor(x); }
-
- /// <summary>Returns the componentwise fractional parts of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise fractional part of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 frac(double4 x) { return x - floor(x); }
-
-
- /// <summary>Returns the reciprocal a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The reciprocal of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float rcp(float x) { return 1.0f / x; }
-
- /// <summary>Returns the componentwise reciprocal a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise reciprocal of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 rcp(float2 x) { return 1.0f / x; }
-
- /// <summary>Returns the componentwise reciprocal a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise reciprocal of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 rcp(float3 x) { return 1.0f / x; }
-
- /// <summary>Returns the componentwise reciprocal a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise reciprocal of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 rcp(float4 x) { return 1.0f / x; }
-
-
- /// <summary>Returns the reciprocal a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The reciprocal of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double rcp(double x) { return 1.0 / x; }
-
- /// <summary>Returns the componentwise reciprocal a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise reciprocal of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 rcp(double2 x) { return 1.0 / x; }
-
- /// <summary>Returns the componentwise reciprocal a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise reciprocal of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 rcp(double3 x) { return 1.0 / x; }
-
- /// <summary>Returns the componentwise reciprocal a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise reciprocal of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 rcp(double4 x) { return 1.0 / x; }
-
- /// <summary>Returns the sign of a int value. -1 if it is less than zero, 0 if it is zero and 1 if it greater than zero.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int sign(int x) { return (x > 0 ? 1 : 0) - (x < 0 ? 1 : 0); }
-
- /// <summary>Returns the componentwise sign of a int2 value. 1 for positive components, 0 for zero components and -1 for negative components.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 sign(int2 x) { return new int2(sign(x.x), sign(x.y)); }
-
- /// <summary>Returns the componentwise sign of a int3 value. 1 for positive components, 0 for zero components and -1 for negative components.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 sign(int3 x) { return new int3(sign(x.x), sign(x.y), sign(x.z)); }
-
- /// <summary>Returns the componentwise sign of a int4 value. 1 for positive components, 0 for zero components and -1 for negative components.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 sign(int4 x) { return new int4(sign(x.x), sign(x.y), sign(x.z), sign(x.w)); }
-
- /// <summary>Returns the sign of a float value. -1.0f if it is less than zero, 0.0f if it is zero and 1.0f if it greater than zero.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float sign(float x) { return (x > 0.0f ? 1.0f : 0.0f) - (x < 0.0f ? 1.0f : 0.0f); }
-
- /// <summary>Returns the componentwise sign of a float2 value. 1.0f for positive components, 0.0f for zero components and -1.0f for negative components.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 sign(float2 x) { return new float2(sign(x.x), sign(x.y)); }
-
- /// <summary>Returns the componentwise sign of a float3 value. 1.0f for positive components, 0.0f for zero components and -1.0f for negative components.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 sign(float3 x) { return new float3(sign(x.x), sign(x.y), sign(x.z)); }
-
- /// <summary>Returns the componentwise sign of a float4 value. 1.0f for positive components, 0.0f for zero components and -1.0f for negative components.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 sign(float4 x) { return new float4(sign(x.x), sign(x.y), sign(x.z), sign(x.w)); }
-
-
- /// <summary>Returns the sign of a double value. -1.0 if it is less than zero, 0.0 if it is zero and 1.0 if it greater than zero.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double sign(double x) { return x == 0 ? 0 : (x > 0.0 ? 1.0 : 0.0) - (x < 0.0 ? 1.0 : 0.0); }
-
- /// <summary>Returns the componentwise sign of a double2 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 sign(double2 x) { return new double2(sign(x.x), sign(x.y)); }
-
- /// <summary>Returns the componentwise sign of a double3 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 sign(double3 x) { return new double3(sign(x.x), sign(x.y), sign(x.z)); }
-
- /// <summary>Returns the componentwise sign of a double4 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise sign of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 sign(double4 x) { return new double4(sign(x.x), sign(x.y), sign(x.z), sign(x.w)); }
-
-
- /// <summary>Returns x raised to the power y.</summary>
- /// <param name="x">The exponent base.</param>
- /// <param name="y">The exponent power.</param>
- /// <returns>The result of raising x to the power y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float pow(float x, float y) { return (float)System.Math.Pow((float)x, (float)y); }
-
- /// <summary>Returns the componentwise result of raising x to the power y.</summary>
- /// <param name="x">The exponent base.</param>
- /// <param name="y">The exponent power.</param>
- /// <returns>The componentwise result of raising x to the power y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 pow(float2 x, float2 y) { return new float2(pow(x.x, y.x), pow(x.y, y.y)); }
-
- /// <summary>Returns the componentwise result of raising x to the power y.</summary>
- /// <param name="x">The exponent base.</param>
- /// <param name="y">The exponent power.</param>
- /// <returns>The componentwise result of raising x to the power y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 pow(float3 x, float3 y) { return new float3(pow(x.x, y.x), pow(x.y, y.y), pow(x.z, y.z)); }
-
- /// <summary>Returns the componentwise result of raising x to the power y.</summary>
- /// <param name="x">The exponent base.</param>
- /// <param name="y">The exponent power.</param>
- /// <returns>The componentwise result of raising x to the power y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 pow(float4 x, float4 y) { return new float4(pow(x.x, y.x), pow(x.y, y.y), pow(x.z, y.z), pow(x.w, y.w)); }
-
-
- /// <summary>Returns x raised to the power y.</summary>
- /// <param name="x">The exponent base.</param>
- /// <param name="y">The exponent power.</param>
- /// <returns>The result of raising x to the power y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double pow(double x, double y) { return System.Math.Pow(x, y); }
-
- /// <summary>Returns the componentwise result of raising x to the power y.</summary>
- /// <param name="x">The exponent base.</param>
- /// <param name="y">The exponent power.</param>
- /// <returns>The componentwise result of raising x to the power y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 pow(double2 x, double2 y) { return new double2(pow(x.x, y.x), pow(x.y, y.y)); }
-
- /// <summary>Returns the componentwise result of raising x to the power y.</summary>
- /// <param name="x">The exponent base.</param>
- /// <param name="y">The exponent power.</param>
- /// <returns>The componentwise result of raising x to the power y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 pow(double3 x, double3 y) { return new double3(pow(x.x, y.x), pow(x.y, y.y), pow(x.z, y.z)); }
-
- /// <summary>Returns the componentwise result of raising x to the power y.</summary>
- /// <param name="x">The exponent base.</param>
- /// <param name="y">The exponent power.</param>
- /// <returns>The componentwise result of raising x to the power y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 pow(double4 x, double4 y) { return new double4(pow(x.x, y.x), pow(x.y, y.y), pow(x.z, y.z), pow(x.w, y.w)); }
-
-
- /// <summary>Returns the base-e exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-e exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float exp(float x) { return (float)System.Math.Exp((float)x); }
-
- /// <summary>Returns the componentwise base-e exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-e exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 exp(float2 x) { return new float2(exp(x.x), exp(x.y)); }
-
- /// <summary>Returns the componentwise base-e exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-e exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 exp(float3 x) { return new float3(exp(x.x), exp(x.y), exp(x.z)); }
-
- /// <summary>Returns the componentwise base-e exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-e exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 exp(float4 x) { return new float4(exp(x.x), exp(x.y), exp(x.z), exp(x.w)); }
-
-
- /// <summary>Returns the base-e exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-e exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double exp(double x) { return System.Math.Exp(x); }
-
- /// <summary>Returns the componentwise base-e exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-e exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 exp(double2 x) { return new double2(exp(x.x), exp(x.y)); }
-
- /// <summary>Returns the componentwise base-e exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-e exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 exp(double3 x) { return new double3(exp(x.x), exp(x.y), exp(x.z)); }
-
- /// <summary>Returns the componentwise base-e exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-e exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 exp(double4 x) { return new double4(exp(x.x), exp(x.y), exp(x.z), exp(x.w)); }
-
-
- /// <summary>Returns the base-2 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-2 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float exp2(float x) { return (float)System.Math.Exp((float)x * 0.69314718f); }
-
- /// <summary>Returns the componentwise base-2 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 exp2(float2 x) { return new float2(exp2(x.x), exp2(x.y)); }
-
- /// <summary>Returns the componentwise base-2 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 exp2(float3 x) { return new float3(exp2(x.x), exp2(x.y), exp2(x.z)); }
-
- /// <summary>Returns the componentwise base-2 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 exp2(float4 x) { return new float4(exp2(x.x), exp2(x.y), exp2(x.z), exp2(x.w)); }
-
-
- /// <summary>Returns the base-2 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-2 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double exp2(double x) { return System.Math.Exp(x * 0.693147180559945309); }
-
- /// <summary>Returns the componentwise base-2 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 exp2(double2 x) { return new double2(exp2(x.x), exp2(x.y)); }
-
- /// <summary>Returns the componentwise base-2 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 exp2(double3 x) { return new double3(exp2(x.x), exp2(x.y), exp2(x.z)); }
-
- /// <summary>Returns the componentwise base-2 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 exp2(double4 x) { return new double4(exp2(x.x), exp2(x.y), exp2(x.z), exp2(x.w)); }
-
-
- /// <summary>Returns the base-10 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-10 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float exp10(float x) { return (float)System.Math.Exp((float)x * 2.30258509f); }
-
- /// <summary>Returns the componentwise base-10 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 exp10(float2 x) { return new float2(exp10(x.x), exp10(x.y)); }
-
- /// <summary>Returns the componentwise base-10 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 exp10(float3 x) { return new float3(exp10(x.x), exp10(x.y), exp10(x.z)); }
-
- /// <summary>Returns the componentwise base-10 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 exp10(float4 x) { return new float4(exp10(x.x), exp10(x.y), exp10(x.z), exp10(x.w)); }
-
-
- /// <summary>Returns the base-10 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-10 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double exp10(double x) { return System.Math.Exp(x * 2.302585092994045684); }
-
- /// <summary>Returns the componentwise base-10 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 exp10(double2 x) { return new double2(exp10(x.x), exp10(x.y)); }
-
- /// <summary>Returns the componentwise base-10 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 exp10(double3 x) { return new double3(exp10(x.x), exp10(x.y), exp10(x.z)); }
-
- /// <summary>Returns the componentwise base-10 exponential of x.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 exponential of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 exp10(double4 x) { return new double4(exp10(x.x), exp10(x.y), exp10(x.z), exp10(x.w)); }
-
-
- /// <summary>Returns the natural logarithm of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The natural logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float log(float x) { return (float)System.Math.Log((float)x); }
-
- /// <summary>Returns the componentwise natural logarithm of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise natural logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 log(float2 x) { return new float2(log(x.x), log(x.y)); }
-
- /// <summary>Returns the componentwise natural logarithm of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise natural logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 log(float3 x) { return new float3(log(x.x), log(x.y), log(x.z)); }
-
- /// <summary>Returns the componentwise natural logarithm of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise natural logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 log(float4 x) { return new float4(log(x.x), log(x.y), log(x.z), log(x.w)); }
-
-
- /// <summary>Returns the natural logarithm of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The natural logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double log(double x) { return System.Math.Log(x); }
-
- /// <summary>Returns the componentwise natural logarithm of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise natural logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 log(double2 x) { return new double2(log(x.x), log(x.y)); }
-
- /// <summary>Returns the componentwise natural logarithm of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise natural logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 log(double3 x) { return new double3(log(x.x), log(x.y), log(x.z)); }
-
- /// <summary>Returns the componentwise natural logarithm of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise natural logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 log(double4 x) { return new double4(log(x.x), log(x.y), log(x.z), log(x.w)); }
-
-
- /// <summary>Returns the base-2 logarithm of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-2 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float log2(float x) { return (float)System.Math.Log((float)x, 2.0f); }
-
- /// <summary>Returns the componentwise base-2 logarithm of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 log2(float2 x) { return new float2(log2(x.x), log2(x.y)); }
-
- /// <summary>Returns the componentwise base-2 logarithm of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 log2(float3 x) { return new float3(log2(x.x), log2(x.y), log2(x.z)); }
-
- /// <summary>Returns the componentwise base-2 logarithm of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 log2(float4 x) { return new float4(log2(x.x), log2(x.y), log2(x.z), log2(x.w)); }
-
-
- /// <summary>Returns the base-2 logarithm of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-2 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double log2(double x) { return System.Math.Log(x, 2.0); }
-
- /// <summary>Returns the componentwise base-2 logarithm of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 log2(double2 x) { return new double2(log2(x.x), log2(x.y)); }
-
- /// <summary>Returns the componentwise base-2 logarithm of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 log2(double3 x) { return new double3(log2(x.x), log2(x.y), log2(x.z)); }
-
- /// <summary>Returns the componentwise base-2 logarithm of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-2 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 log2(double4 x) { return new double4(log2(x.x), log2(x.y), log2(x.z), log2(x.w)); }
-
- /// <summary>Returns the base-10 logarithm of a float value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-10 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float log10(float x) { return (float)System.Math.Log10((float)x); }
-
- /// <summary>Returns the componentwise base-10 logarithm of a float2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 log10(float2 x) { return new float2(log10(x.x), log10(x.y)); }
-
- /// <summary>Returns the componentwise base-10 logarithm of a float3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 log10(float3 x) { return new float3(log10(x.x), log10(x.y), log10(x.z)); }
-
- /// <summary>Returns the componentwise base-10 logarithm of a float4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 log10(float4 x) { return new float4(log10(x.x), log10(x.y), log10(x.z), log10(x.w)); }
-
-
- /// <summary>Returns the base-10 logarithm of a double value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The base-10 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double log10(double x) { return System.Math.Log10(x); }
-
- /// <summary>Returns the componentwise base-10 logarithm of a double2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 log10(double2 x) { return new double2(log10(x.x), log10(x.y)); }
-
- /// <summary>Returns the componentwise base-10 logarithm of a double3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 log10(double3 x) { return new double3(log10(x.x), log10(x.y), log10(x.z)); }
-
- /// <summary>Returns the componentwise base-10 logarithm of a double4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise base-10 logarithm of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 log10(double4 x) { return new double4(log10(x.x), log10(x.y), log10(x.z), log10(x.w)); }
-
-
- /// <summary>Returns the floating point remainder of x/y.</summary>
- /// <param name="x">The dividend in x/y.</param>
- /// <param name="y">The divisor in x/y.</param>
- /// <returns>The remainder of x/y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float fmod(float x, float y) { return x % y; }
-
- /// <summary>Returns the componentwise floating point remainder of x/y.</summary>
- /// <param name="x">The dividend in x/y.</param>
- /// <param name="y">The divisor in x/y.</param>
- /// <returns>The componentwise remainder of x/y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 fmod(float2 x, float2 y) { return new float2(x.x % y.x, x.y % y.y); }
-
- /// <summary>Returns the componentwise floating point remainder of x/y.</summary>
- /// <param name="x">The dividend in x/y.</param>
- /// <param name="y">The divisor in x/y.</param>
- /// <returns>The componentwise remainder of x/y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 fmod(float3 x, float3 y) { return new float3(x.x % y.x, x.y % y.y, x.z % y.z); }
-
- /// <summary>Returns the componentwise floating point remainder of x/y.</summary>
- /// <param name="x">The dividend in x/y.</param>
- /// <param name="y">The divisor in x/y.</param>
- /// <returns>The componentwise remainder of x/y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 fmod(float4 x, float4 y) { return new float4(x.x % y.x, x.y % y.y, x.z % y.z, x.w % y.w); }
-
-
- /// <summary>Returns the double precision floating point remainder of x/y.</summary>
- /// <param name="x">The dividend in x/y.</param>
- /// <param name="y">The divisor in x/y.</param>
- /// <returns>The remainder of x/y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double fmod(double x, double y) { return x % y; }
-
- /// <summary>Returns the componentwise double precision floating point remainder of x/y.</summary>
- /// <param name="x">The dividend in x/y.</param>
- /// <param name="y">The divisor in x/y.</param>
- /// <returns>The componentwise remainder of x/y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 fmod(double2 x, double2 y) { return new double2(x.x % y.x, x.y % y.y); }
-
- /// <summary>Returns the componentwise double precision floating point remainder of x/y.</summary>
- /// <param name="x">The dividend in x/y.</param>
- /// <param name="y">The divisor in x/y.</param>
- /// <returns>The componentwise remainder of x/y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 fmod(double3 x, double3 y) { return new double3(x.x % y.x, x.y % y.y, x.z % y.z); }
-
- /// <summary>Returns the componentwise double precision floating point remainder of x/y.</summary>
- /// <param name="x">The dividend in x/y.</param>
- /// <param name="y">The divisor in x/y.</param>
- /// <returns>The componentwise remainder of x/y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 fmod(double4 x, double4 y) { return new double4(x.x % y.x, x.y % y.y, x.z % y.z, x.w % y.w); }
-
-
- /// <summary>Splits a float value into an integral part i and a fractional part that gets returned. Both parts take the sign of the input.</summary>
- /// <param name="x">Value to split into integral and fractional part.</param>
- /// <param name="i">Output value containing integral part of x.</param>
- /// <returns>The fractional part of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float modf(float x, out float i) { i = trunc(x); return x - i; }
-
- /// <summary>
- /// Performs a componentwise split of a float2 vector into an integral part i and a fractional part that gets returned.
- /// Both parts take the sign of the corresponding input component.
- /// </summary>
- /// <param name="x">Value to split into integral and fractional part.</param>
- /// <param name="i">Output value containing integral part of x.</param>
- /// <returns>The componentwise fractional part of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 modf(float2 x, out float2 i) { i = trunc(x); return x - i; }
-
- /// <summary>
- /// Performs a componentwise split of a float3 vector into an integral part i and a fractional part that gets returned.
- /// Both parts take the sign of the corresponding input component.
- /// </summary>
- /// <param name="x">Value to split into integral and fractional part.</param>
- /// <param name="i">Output value containing integral part of x.</param>
- /// <returns>The componentwise fractional part of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 modf(float3 x, out float3 i) { i = trunc(x); return x - i; }
-
- /// <summary>
- /// Performs a componentwise split of a float4 vector into an integral part i and a fractional part that gets returned.
- /// Both parts take the sign of the corresponding input component.
- /// </summary>
- /// <param name="x">Value to split into integral and fractional part.</param>
- /// <param name="i">Output value containing integral part of x.</param>
- /// <returns>The componentwise fractional part of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 modf(float4 x, out float4 i) { i = trunc(x); return x - i; }
-
-
- /// <summary>Splits a double value into an integral part i and a fractional part that gets returned. Both parts take the sign of the input.</summary>
- /// <param name="x">Value to split into integral and fractional part.</param>
- /// <param name="i">Output value containing integral part of x.</param>
- /// <returns>The fractional part of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double modf(double x, out double i) { i = trunc(x); return x - i; }
-
- /// <summary>
- /// Performs a componentwise split of a double2 vector into an integral part i and a fractional part that gets returned.
- /// Both parts take the sign of the corresponding input component.
- /// </summary>
- /// <param name="x">Value to split into integral and fractional part.</param>
- /// <param name="i">Output value containing integral part of x.</param>
- /// <returns>The componentwise fractional part of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 modf(double2 x, out double2 i) { i = trunc(x); return x - i; }
-
- /// <summary>
- /// Performs a componentwise split of a double3 vector into an integral part i and a fractional part that gets returned.
- /// Both parts take the sign of the corresponding input component.
- /// </summary>
- /// <param name="x">Value to split into integral and fractional part.</param>
- /// <param name="i">Output value containing integral part of x.</param>
- /// <returns>The componentwise fractional part of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 modf(double3 x, out double3 i) { i = trunc(x); return x - i; }
-
- /// <summary>
- /// Performs a componentwise split of a double4 vector into an integral part i and a fractional part that gets returned.
- /// Both parts take the sign of the corresponding input component.
- /// </summary>
- /// <param name="x">Value to split into integral and fractional part.</param>
- /// <param name="i">Output value containing integral part of x.</param>
- /// <returns>The componentwise fractional part of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 modf(double4 x, out double4 i) { i = trunc(x); return x - i; }
-
-
- /// <summary>Returns the square root of a float value.</summary>
- /// <param name="x">Value to use when computing square root.</param>
- /// <returns>The square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float sqrt(float x) { return (float)System.Math.Sqrt((float)x); }
-
- /// <summary>Returns the componentwise square root of a float2 vector.</summary>
- /// <param name="x">Value to use when computing square root.</param>
- /// <returns>The componentwise square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 sqrt(float2 x) { return new float2(sqrt(x.x), sqrt(x.y)); }
-
- /// <summary>Returns the componentwise square root of a float3 vector.</summary>
- /// <param name="x">Value to use when computing square root.</param>
- /// <returns>The componentwise square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 sqrt(float3 x) { return new float3(sqrt(x.x), sqrt(x.y), sqrt(x.z)); }
-
- /// <summary>Returns the componentwise square root of a float4 vector.</summary>
- /// <param name="x">Value to use when computing square root.</param>
- /// <returns>The componentwise square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 sqrt(float4 x) { return new float4(sqrt(x.x), sqrt(x.y), sqrt(x.z), sqrt(x.w)); }
-
-
- /// <summary>Returns the square root of a double value.</summary>
- /// <param name="x">Value to use when computing square root.</param>
- /// <returns>The square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double sqrt(double x) { return System.Math.Sqrt(x); }
-
- /// <summary>Returns the componentwise square root of a double2 vector.</summary>
- /// <param name="x">Value to use when computing square root.</param>
- /// <returns>The componentwise square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 sqrt(double2 x) { return new double2(sqrt(x.x), sqrt(x.y)); }
-
- /// <summary>Returns the componentwise square root of a double3 vector.</summary>
- /// <param name="x">Value to use when computing square root.</param>
- /// <returns>The componentwise square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 sqrt(double3 x) { return new double3(sqrt(x.x), sqrt(x.y), sqrt(x.z)); }
-
- /// <summary>Returns the componentwise square root of a double4 vector.</summary>
- /// <param name="x">Value to use when computing square root.</param>
- /// <returns>The componentwise square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 sqrt(double4 x) { return new double4(sqrt(x.x), sqrt(x.y), sqrt(x.z), sqrt(x.w)); }
-
-
- /// <summary>Returns the reciprocal square root of a float value.</summary>
- /// <param name="x">Value to use when computing reciprocal square root.</param>
- /// <returns>The reciprocal square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float rsqrt(float x) { return 1.0f / sqrt(x); }
-
- /// <summary>Returns the componentwise reciprocal square root of a float2 vector.</summary>
- /// <param name="x">Value to use when computing reciprocal square root.</param>
- /// <returns>The componentwise reciprocal square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 rsqrt(float2 x) { return 1.0f / sqrt(x); }
-
- /// <summary>Returns the componentwise reciprocal square root of a float3 vector.</summary>
- /// <param name="x">Value to use when computing reciprocal square root.</param>
- /// <returns>The componentwise reciprocal square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 rsqrt(float3 x) { return 1.0f / sqrt(x); }
-
- /// <summary>Returns the componentwise reciprocal square root of a float4 vector</summary>
- /// <param name="x">Value to use when computing reciprocal square root.</param>
- /// <returns>The componentwise reciprocal square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 rsqrt(float4 x) { return 1.0f / sqrt(x); }
-
-
- /// <summary>Returns the reciprocal square root of a double value.</summary>
- /// <param name="x">Value to use when computing reciprocal square root.</param>
- /// <returns>The reciprocal square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double rsqrt(double x) { return 1.0 / sqrt(x); }
-
- /// <summary>Returns the componentwise reciprocal square root of a double2 vector.</summary>
- /// <param name="x">Value to use when computing reciprocal square root.</param>
- /// <returns>The componentwise reciprocal square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 rsqrt(double2 x) { return 1.0 / sqrt(x); }
-
- /// <summary>Returns the componentwise reciprocal square root of a double3 vector.</summary>
- /// <param name="x">Value to use when computing reciprocal square root.</param>
- /// <returns>The componentwise reciprocal square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 rsqrt(double3 x) { return 1.0 / sqrt(x); }
-
- /// <summary>Returns the componentwise reciprocal square root of a double4 vector.</summary>
- /// <param name="x">Value to use when computing reciprocal square root.</param>
- /// <returns>The componentwise reciprocal square root.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 rsqrt(double4 x) { return 1.0 / sqrt(x); }
-
-
- /// <summary>Returns a normalized version of the float2 vector x by scaling it by 1 / length(x).</summary>
- /// <param name="x">Vector to normalize.</param>
- /// <returns>The normalized vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 normalize(float2 x) { return rsqrt(dot(x, x)) * x; }
-
- /// <summary>Returns a normalized version of the float3 vector x by scaling it by 1 / length(x).</summary>
- /// <param name="x">Vector to normalize.</param>
- /// <returns>The normalized vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 normalize(float3 x) { return rsqrt(dot(x, x)) * x; }
-
- /// <summary>Returns a normalized version of the float4 vector x by scaling it by 1 / length(x).</summary>
- /// <param name="x">Vector to normalize.</param>
- /// <returns>The normalized vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 normalize(float4 x) { return rsqrt(dot(x, x)) * x; }
-
-
- /// <summary>Returns a normalized version of the double2 vector x by scaling it by 1 / length(x).</summary>
- /// <param name="x">Vector to normalize.</param>
- /// <returns>The normalized vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 normalize(double2 x) { return rsqrt(dot(x, x)) * x; }
-
- /// <summary>Returns a normalized version of the double3 vector x by scaling it by 1 / length(x).</summary>
- /// <param name="x">Vector to normalize.</param>
- /// <returns>The normalized vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 normalize(double3 x) { return rsqrt(dot(x, x)) * x; }
-
- /// <summary>Returns a normalized version of the double4 vector x by scaling it by 1 / length(x).</summary>
- /// <param name="x">Vector to normalize.</param>
- /// <returns>The normalized vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 normalize(double4 x) { return rsqrt(dot(x, x)) * x; }
-
-
- /// <summary>
- /// Returns a safe normalized version of the float2 vector x by scaling it by 1 / length(x).
- /// Returns the given default value when 1 / length(x) does not produce a finite number.
- /// </summary>
- /// <param name="x">Vector to normalize.</param>
- /// <param name="defaultvalue">Vector to return if normalized vector is not finite.</param>
- /// <returns>The normalized vector or the default value if the normalized vector is not finite.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- static public float2 normalizesafe(float2 x, float2 defaultvalue = new float2())
- {
- float len = math.dot(x, x);
- return math.select(defaultvalue, x * math.rsqrt(len), len > FLT_MIN_NORMAL);
- }
-
- /// <summary>
- /// Returns a safe normalized version of the float3 vector x by scaling it by 1 / length(x).
- /// Returns the given default value when 1 / length(x) does not produce a finite number.
- /// </summary>
- /// <param name="x">Vector to normalize.</param>
- /// <param name="defaultvalue">Vector to return if normalized vector is not finite.</param>
- /// <returns>The normalized vector or the default value if the normalized vector is not finite.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- static public float3 normalizesafe(float3 x, float3 defaultvalue = new float3())
- {
- float len = math.dot(x, x);
- return math.select(defaultvalue, x * math.rsqrt(len), len > FLT_MIN_NORMAL);
- }
-
- /// <summary>
- /// Returns a safe normalized version of the float4 vector x by scaling it by 1 / length(x).
- /// Returns the given default value when 1 / length(x) does not produce a finite number.
- /// </summary>
- /// <param name="x">Vector to normalize.</param>
- /// <param name="defaultvalue">Vector to return if normalized vector is not finite.</param>
- /// <returns>The normalized vector or the default value if the normalized vector is not finite.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- static public float4 normalizesafe(float4 x, float4 defaultvalue = new float4())
- {
- float len = math.dot(x, x);
- return math.select(defaultvalue, x * math.rsqrt(len), len > FLT_MIN_NORMAL);
- }
-
-
- /// <summary>
- /// Returns a safe normalized version of the double4 vector x by scaling it by 1 / length(x).
- /// Returns the given default value when 1 / length(x) does not produce a finite number.
- /// </summary>
- /// <param name="x">Vector to normalize.</param>
- /// <param name="defaultvalue">Vector to return if normalized vector is not finite.</param>
- /// <returns>The normalized vector or the default value if the normalized vector is not finite.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- static public double2 normalizesafe(double2 x, double2 defaultvalue = new double2())
- {
- double len = math.dot(x, x);
- return math.select(defaultvalue, x * math.rsqrt(len), len > FLT_MIN_NORMAL);
- }
-
- /// <summary>
- /// Returns a safe normalized version of the double4 vector x by scaling it by 1 / length(x).
- /// Returns the given default value when 1 / length(x) does not produce a finite number.
- /// </summary>
- /// <param name="x">Vector to normalize.</param>
- /// <param name="defaultvalue">Vector to return if normalized vector is not finite.</param>
- /// <returns>The normalized vector or the default value if the normalized vector is not finite.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- static public double3 normalizesafe(double3 x, double3 defaultvalue = new double3())
- {
- double len = math.dot(x, x);
- return math.select(defaultvalue, x * math.rsqrt(len), len > FLT_MIN_NORMAL);
- }
-
- /// <summary>
- /// Returns a safe normalized version of the double4 vector x by scaling it by 1 / length(x).
- /// Returns the given default value when 1 / length(x) does not produce a finite number.
- /// </summary>
- /// <param name="x">Vector to normalize.</param>
- /// <param name="defaultvalue">Vector to return if normalized vector is not finite.</param>
- /// <returns>The normalized vector or the default value if the normalized vector is not finite.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- static public double4 normalizesafe(double4 x, double4 defaultvalue = new double4())
- {
- double len = math.dot(x, x);
- return math.select(defaultvalue, x * math.rsqrt(len), len > FLT_MIN_NORMAL);
- }
-
-
- /// <summary>Returns the length of a float value. Equivalent to the absolute value.</summary>
- /// <param name="x">Value to use when computing length.</param>
- /// <returns>Length of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float length(float x) { return abs(x); }
-
- /// <summary>Returns the length of a float2 vector.</summary>
- /// <param name="x">Vector to use when computing length.</param>
- /// <returns>Length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float length(float2 x) { return sqrt(dot(x, x)); }
-
- /// <summary>Returns the length of a float3 vector.</summary>
- /// <param name="x">Vector to use when computing length.</param>
- /// <returns>Length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float length(float3 x) { return sqrt(dot(x, x)); }
-
- /// <summary>Returns the length of a float4 vector.</summary>
- /// <param name="x">Vector to use when computing length.</param>
- /// <returns>Length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float length(float4 x) { return sqrt(dot(x, x)); }
-
-
- /// <summary>Returns the length of a double value. Equivalent to the absolute value.</summary>
- /// <param name="x">Value to use when computing squared length.</param>
- /// <returns>Squared length of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double length(double x) { return abs(x); }
-
- /// <summary>Returns the length of a double2 vector.</summary>
- /// <param name="x">Vector to use when computing squared length.</param>
- /// <returns>Squared length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double length(double2 x) { return sqrt(dot(x, x)); }
-
- /// <summary>Returns the length of a double3 vector.</summary>
- /// <param name="x">Vector to use when computing squared length.</param>
- /// <returns>Squared length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double length(double3 x) { return sqrt(dot(x, x)); }
-
- /// <summary>Returns the length of a double4 vector.</summary>
- /// <param name="x">Vector to use when computing squared length.</param>
- /// <returns>Squared length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double length(double4 x) { return sqrt(dot(x, x)); }
-
-
- /// <summary>Returns the squared length of a float value. Equivalent to squaring the value.</summary>
- /// <param name="x">Value to use when computing squared length.</param>
- /// <returns>Squared length of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float lengthsq(float x) { return x*x; }
-
- /// <summary>Returns the squared length of a float2 vector.</summary>
- /// <param name="x">Vector to use when computing squared length.</param>
- /// <returns>Squared length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float lengthsq(float2 x) { return dot(x, x); }
-
- /// <summary>Returns the squared length of a float3 vector.</summary>
- /// <param name="x">Vector to use when computing squared length.</param>
- /// <returns>Squared length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float lengthsq(float3 x) { return dot(x, x); }
-
- /// <summary>Returns the squared length of a float4 vector.</summary>
- /// <param name="x">Vector to use when computing squared length.</param>
- /// <returns>Squared length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float lengthsq(float4 x) { return dot(x, x); }
-
-
- /// <summary>Returns the squared length of a double value. Equivalent to squaring the value.</summary>
- /// <param name="x">Value to use when computing squared length.</param>
- /// <returns>Squared length of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double lengthsq(double x) { return x * x; }
-
- /// <summary>Returns the squared length of a double2 vector.</summary>
- /// <param name="x">Vector to use when computing squared length.</param>
- /// <returns>Squared length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double lengthsq(double2 x) { return dot(x, x); }
-
- /// <summary>Returns the squared length of a double3 vector.</summary>
- /// <param name="x">Vector to use when computing squared length.</param>
- /// <returns>Squared length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double lengthsq(double3 x) { return dot(x, x); }
-
- /// <summary>Returns the squared length of a double4 vector.</summary>
- /// <param name="x">Vector to use when computing squared length.</param>
- /// <returns>Squared length of vector x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double lengthsq(double4 x) { return dot(x, x); }
-
-
- /// <summary>Returns the distance between two float values.</summary>
- /// <param name="x">First value to use in distance computation.</param>
- /// <param name="y">Second value to use in distance computation.</param>
- /// <returns>The distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float distance(float x, float y) { return abs(y - x); }
-
- /// <summary>Returns the distance between two float2 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float distance(float2 x, float2 y) { return length(y - x); }
-
- /// <summary>Returns the distance between two float3 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float distance(float3 x, float3 y) { return length(y - x); }
-
- /// <summary>Returns the distance between two float4 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float distance(float4 x, float4 y) { return length(y - x); }
-
-
- /// <summary>Returns the distance between two double values.</summary>
- /// <param name="x">First value to use in distance computation.</param>
- /// <param name="y">Second value to use in distance computation.</param>
- /// <returns>The distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double distance(double x, double y) { return abs(y - x); }
-
- /// <summary>Returns the distance between two double2 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double distance(double2 x, double2 y) { return length(y - x); }
-
- /// <summary>Returns the distance between two double3 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double distance(double3 x, double3 y) { return length(y - x); }
-
- /// <summary>Returns the distance between two double4 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double distance(double4 x, double4 y) { return length(y - x); }
-
-
- /// <summary>Returns the squared distance between two float values.</summary>
- /// <param name="x">First value to use in distance computation.</param>
- /// <param name="y">Second value to use in distance computation.</param>
- /// <returns>The squared distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float distancesq(float x, float y) { return (y - x) * (y - x); }
-
- /// <summary>Returns the squared distance between two float2 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The squared distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float distancesq(float2 x, float2 y) { return lengthsq(y - x); }
-
- /// <summary>Returns the squared distance between two float3 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The squared distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float distancesq(float3 x, float3 y) { return lengthsq(y - x); }
-
- /// <summary>Returns the squared distance between two float4 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The squared distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float distancesq(float4 x, float4 y) { return lengthsq(y - x); }
-
-
- /// <summary>Returns the squared distance between two double values.</summary>
- /// <param name="x">First value to use in distance computation.</param>
- /// <param name="y">Second value to use in distance computation.</param>
- /// <returns>The squared distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double distancesq(double x, double y) { return (y - x) * (y - x); }
-
- /// <summary>Returns the squared distance between two double2 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The squared distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double distancesq(double2 x, double2 y) { return lengthsq(y - x); }
-
- /// <summary>Returns the squared distance between two double3 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The squared distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double distancesq(double3 x, double3 y) { return lengthsq(y - x); }
-
- /// <summary>Returns the squared distance between two double4 vectors.</summary>
- /// <param name="x">First vector to use in distance computation.</param>
- /// <param name="y">Second vector to use in distance computation.</param>
- /// <returns>The squared distance between x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double distancesq(double4 x, double4 y) { return lengthsq(y - x); }
-
-
- /// <summary>Returns the cross product of two float3 vectors.</summary>
- /// <param name="x">First vector to use in cross product.</param>
- /// <param name="y">Second vector to use in cross product.</param>
- /// <returns>The cross product of x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 cross(float3 x, float3 y) { return (x * y.yzx - x.yzx * y).yzx; }
-
- /// <summary>Returns the cross product of two double3 vectors.</summary>
- /// <param name="x">First vector to use in cross product.</param>
- /// <param name="y">Second vector to use in cross product.</param>
- /// <returns>The cross product of x and y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 cross(double3 x, double3 y) { return (x * y.yzx - x.yzx * y).yzx; }
-
-
- /// <summary>Returns a smooth Hermite interpolation between 0.0f and 1.0f when x is in the interval (inclusive) [xMin, xMax].</summary>
- /// <param name="xMin">The minimum range of the x parameter.</param>
- /// <param name="xMax">The maximum range of the x parameter.</param>
- /// <param name="x">The value to be interpolated.</param>
- /// <returns>Returns a value camped to the range [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float smoothstep(float xMin, float xMax, float x)
- {
- var t = saturate((x - xMin) / (xMax - xMin));
- return t * t * (3.0f - (2.0f * t));
- }
-
- /// <summary>Returns a componentwise smooth Hermite interpolation between 0.0f and 1.0f when x is in the interval (inclusive) [xMin, xMax].</summary>
- /// <param name="xMin">The minimum range of the x parameter.</param>
- /// <param name="xMax">The maximum range of the x parameter.</param>
- /// <param name="x">The value to be interpolated.</param>
- /// <returns>Returns component values camped to the range [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 smoothstep(float2 xMin, float2 xMax, float2 x)
- {
- var t = saturate((x - xMin) / (xMax - xMin));
- return t * t * (3.0f - (2.0f * t));
- }
-
- /// <summary>Returns a componentwise smooth Hermite interpolation between 0.0f and 1.0f when x is in the interval (inclusive) [xMin, xMax].</summary>
- /// <param name="xMin">The minimum range of the x parameter.</param>
- /// <param name="xMax">The maximum range of the x parameter.</param>
- /// <param name="x">The value to be interpolated.</param>
- /// <returns>Returns component values camped to the range [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 smoothstep(float3 xMin, float3 xMax, float3 x)
- {
- var t = saturate((x - xMin) / (xMax - xMin));
- return t * t * (3.0f - (2.0f * t));
- }
-
- /// <summary>Returns a componentwise smooth Hermite interpolation between 0.0f and 1.0f when x is in the interval (inclusive) [xMin, xMax].</summary>
- /// <param name="xMin">The minimum range of the x parameter.</param>
- /// <param name="xMax">The maximum range of the x parameter.</param>
- /// <param name="x">The value to be interpolated.</param>
- /// <returns>Returns component values camped to the range [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 smoothstep(float4 xMin, float4 xMax, float4 x)
- {
- var t = saturate((x - xMin) / (xMax - xMin));
- return t * t * (3.0f - (2.0f * t));
- }
-
-
- /// <summary>Returns a smooth Hermite interpolation between 0.0 and 1.0 when x is in the interval (inclusive) [xMin, xMax].</summary>
- /// <param name="xMin">The minimum range of the x parameter.</param>
- /// <param name="xMax">The maximum range of the x parameter.</param>
- /// <param name="x">The value to be interpolated.</param>
- /// <returns>Returns a value camped to the range [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double smoothstep(double xMin, double xMax, double x)
- {
- var t = saturate((x - xMin) / (xMax - xMin));
- return t * t * (3.0 - (2.0 * t));
- }
-
- /// <summary>Returns a componentwise smooth Hermite interpolation between 0.0 and 1.0 when x is in the interval (inclusive) [xMin, xMax].</summary>
- /// <param name="xMin">The minimum range of the x parameter.</param>
- /// <param name="xMax">The maximum range of the x parameter.</param>
- /// <param name="x">The value to be interpolated.</param>
- /// <returns>Returns component values camped to the range [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 smoothstep(double2 xMin, double2 xMax, double2 x)
- {
- var t = saturate((x - xMin) / (xMax - xMin));
- return t * t * (3.0 - (2.0 * t));
- }
-
- /// <summary>Returns a componentwise smooth Hermite interpolation between 0.0 and 1.0 when x is in the interval (inclusive) [xMin, xMax].</summary>
- /// <param name="xMin">The minimum range of the x parameter.</param>
- /// <param name="xMax">The maximum range of the x parameter.</param>
- /// <param name="x">The value to be interpolated.</param>
- /// <returns>Returns component values camped to the range [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 smoothstep(double3 xMin, double3 xMax, double3 x)
- {
- var t = saturate((x - xMin) / (xMax - xMin));
- return t * t * (3.0 - (2.0 * t));
- }
-
- /// <summary>Returns a componentwise smooth Hermite interpolation between 0.0 and 1.0 when x is in the interval (inclusive) [xMin, xMax].</summary>
- /// <param name="xMin">The minimum range of the x parameter.</param>
- /// <param name="xMax">The maximum range of the x parameter.</param>
- /// <param name="x">The value to be interpolated.</param>
- /// <returns>Returns component values camped to the range [0, 1].</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 smoothstep(double4 xMin, double4 xMax, double4 x)
- {
- var t = saturate((x - xMin) / (xMax - xMin));
- return t * t * (3.0 - (2.0 * t));
- }
-
-
- /// <summary>Returns true if any component of the input bool2 vector is true, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are true, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(bool2 x) { return x.x || x.y; }
-
- /// <summary>Returns true if any component of the input bool3 vector is true, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are true, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(bool3 x) { return x.x || x.y || x.z; }
-
- /// <summary>Returns true if any components of the input bool4 vector is true, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are true, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(bool4 x) { return x.x || x.y || x.z || x.w; }
-
-
- /// <summary>Returns true if any component of the input int2 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(int2 x) { return x.x != 0 || x.y != 0; }
-
- /// <summary>Returns true if any component of the input int3 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(int3 x) { return x.x != 0 || x.y != 0 || x.z != 0; }
-
- /// <summary>Returns true if any components of the input int4 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(int4 x) { return x.x != 0 || x.y != 0 || x.z != 0 || x.w != 0; }
-
-
- /// <summary>Returns true if any component of the input uint2 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(uint2 x) { return x.x != 0 || x.y != 0; }
-
- /// <summary>Returns true if any component of the input uint3 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(uint3 x) { return x.x != 0 || x.y != 0 || x.z != 0; }
-
- /// <summary>Returns true if any components of the input uint4 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(uint4 x) { return x.x != 0 || x.y != 0 || x.z != 0 || x.w != 0; }
-
-
- /// <summary>Returns true if any component of the input float2 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(float2 x) { return x.x != 0.0f || x.y != 0.0f; }
-
- /// <summary>Returns true if any component of the input float3 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(float3 x) { return x.x != 0.0f || x.y != 0.0f || x.z != 0.0f; }
-
- /// <summary>Returns true if any component of the input float4 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(float4 x) { return x.x != 0.0f || x.y != 0.0f || x.z != 0.0f || x.w != 0.0f; }
-
-
- /// <summary>Returns true if any component of the input double2 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(double2 x) { return x.x != 0.0 || x.y != 0.0; }
-
- /// <summary>Returns true if any component of the input double3 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(double3 x) { return x.x != 0.0 || x.y != 0.0 || x.z != 0.0; }
-
- /// <summary>Returns true if any component of the input double4 vector is non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if any the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool any(double4 x) { return x.x != 0.0 || x.y != 0.0 || x.z != 0.0 || x.w != 0.0; }
-
-
- /// <summary>Returns true if all components of the input bool2 vector are true, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are true, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(bool2 x) { return x.x && x.y; }
-
- /// <summary>Returns true if all components of the input bool3 vector are true, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are true, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(bool3 x) { return x.x && x.y && x.z; }
-
- /// <summary>Returns true if all components of the input bool4 vector are true, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are true, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(bool4 x) { return x.x && x.y && x.z && x.w; }
-
-
- /// <summary>Returns true if all components of the input int2 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(int2 x) { return x.x != 0 && x.y != 0; }
-
- /// <summary>Returns true if all components of the input int3 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(int3 x) { return x.x != 0 && x.y != 0 && x.z != 0; }
-
- /// <summary>Returns true if all components of the input int4 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(int4 x) { return x.x != 0 && x.y != 0 && x.z != 0 && x.w != 0; }
-
-
- /// <summary>Returns true if all components of the input uint2 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(uint2 x) { return x.x != 0 && x.y != 0; }
-
- /// <summary>Returns true if all components of the input uint3 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(uint3 x) { return x.x != 0 && x.y != 0 && x.z != 0; }
-
- /// <summary>Returns true if all components of the input uint4 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(uint4 x) { return x.x != 0 && x.y != 0 && x.z != 0 && x.w != 0; }
-
-
- /// <summary>Returns true if all components of the input float2 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(float2 x) { return x.x != 0.0f && x.y != 0.0f; }
-
- /// <summary>Returns true if all components of the input float3 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(float3 x) { return x.x != 0.0f && x.y != 0.0f && x.z != 0.0f; }
-
- /// <summary>Returns true if all components of the input float4 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(float4 x) { return x.x != 0.0f && x.y != 0.0f && x.z != 0.0f && x.w != 0.0f; }
-
-
- /// <summary>Returns true if all components of the input double2 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(double2 x) { return x.x != 0.0 && x.y != 0.0; }
-
- /// <summary>Returns true if all components of the input double3 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(double3 x) { return x.x != 0.0 && x.y != 0.0 && x.z != 0.0; }
-
- /// <summary>Returns true if all components of the input double4 vector are non-zero, false otherwise.</summary>
- /// <param name="x">Vector of values to compare.</param>
- /// <returns>True if all the components of x are non-zero, false otherwise.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static bool all(double4 x) { return x.x != 0.0 && x.y != 0.0 && x.z != 0.0 && x.w != 0.0; }
-
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int select(int falseValue, int trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 select(int2 falseValue, int2 trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 select(int3 falseValue, int3 trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 select(int4 falseValue, int4 trueValue, bool test) { return test ? trueValue : falseValue; }
-
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 select(int2 falseValue, int2 trueValue, bool2 test) { return new int2(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y); }
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 select(int3 falseValue, int3 trueValue, bool3 test) { return new int3(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y, test.z ? trueValue.z : falseValue.z); }
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 select(int4 falseValue, int4 trueValue, bool4 test) { return new int4(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y, test.z ? trueValue.z : falseValue.z, test.w ? trueValue.w : falseValue.w); }
-
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint select(uint falseValue, uint trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 select(uint2 falseValue, uint2 trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 select(uint3 falseValue, uint3 trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 select(uint4 falseValue, uint4 trueValue, bool test) { return test ? trueValue : falseValue; }
-
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 select(uint2 falseValue, uint2 trueValue, bool2 test) { return new uint2(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y); }
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 select(uint3 falseValue, uint3 trueValue, bool3 test) { return new uint3(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y, test.z ? trueValue.z : falseValue.z); }
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 select(uint4 falseValue, uint4 trueValue, bool4 test) { return new uint4(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y, test.z ? trueValue.z : falseValue.z, test.w ? trueValue.w : falseValue.w); }
-
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long select(long falseValue, long trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong select(ulong falseValue, ulong trueValue, bool test) { return test ? trueValue : falseValue; }
-
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float select(float falseValue, float trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 select(float2 falseValue, float2 trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 select(float3 falseValue, float3 trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 select(float4 falseValue, float4 trueValue, bool test) { return test ? trueValue : falseValue; }
-
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 select(float2 falseValue, float2 trueValue, bool2 test) { return new float2(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y); }
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 select(float3 falseValue, float3 trueValue, bool3 test) { return new float3(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y, test.z ? trueValue.z : falseValue.z); }
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 select(float4 falseValue, float4 trueValue, bool4 test) { return new float4(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y, test.z ? trueValue.z : falseValue.z, test.w ? trueValue.w : falseValue.w); }
-
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double select(double falseValue, double trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 select(double2 falseValue, double2 trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 select(double3 falseValue, double3 trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>Returns trueValue if test is true, falseValue otherwise.</summary>
- /// <param name="falseValue">Value to use if test is false.</param>
- /// <param name="trueValue">Value to use if test is true.</param>
- /// <param name="test">Bool value to choose between falseValue and trueValue.</param>
- /// <returns>The selection between falseValue and trueValue according to bool test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 select(double4 falseValue, double4 trueValue, bool test) { return test ? trueValue : falseValue; }
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 select(double2 falseValue, double2 trueValue, bool2 test) { return new double2(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y); }
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 select(double3 falseValue, double3 trueValue, bool3 test) { return new double3(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y, test.z ? trueValue.z : falseValue.z); }
-
- /// <summary>
- /// Returns a componentwise selection between two double4 vectors falseValue and trueValue based on a bool4 selection mask test.
- /// Per component, the component from trueValue is selected when test is true, otherwise the component from falseValue is selected.
- /// </summary>
- /// <param name="falseValue">Values to use if test is false.</param>
- /// <param name="trueValue">Values to use if test is true.</param>
- /// <param name="test">Selection mask to choose between falseValue and trueValue.</param>
- /// <returns>The componentwise selection between falseValue and trueValue according to selection mask test.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 select(double4 falseValue, double4 trueValue, bool4 test) { return new double4(test.x ? trueValue.x : falseValue.x, test.y ? trueValue.y : falseValue.y, test.z ? trueValue.z : falseValue.z, test.w ? trueValue.w : falseValue.w); }
-
-
- /// <summary>Returns the result of a step function where the result is 1.0f when x >= threshold and 0.0f otherwise.</summary>
- /// <param name="threshold">Value to be used as a threshold for returning 1.</param>
- /// <param name="x">Value to compare against threshold.</param>
- /// <returns>1 if the comparison x >= threshold is true, otherwise 0.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float step(float threshold, float x) { return select(0.0f, 1.0f, x >= threshold); }
-
- /// <summary>Returns the result of a componentwise step function where each component is 1.0f when x >= threshold and 0.0f otherwise.</summary>
- /// <param name="threshold">Vector of values to be used as a threshold for returning 1.</param>
- /// <param name="x">Vector of values to compare against threshold.</param>
- /// <returns>1 if the componentwise comparison x >= threshold is true, otherwise 0.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 step(float2 threshold, float2 x) { return select(float2(0.0f), float2(1.0f), x >= threshold); }
-
- /// <summary>Returns the result of a componentwise step function where each component is 1.0f when x >= threshold and 0.0f otherwise.</summary>
- /// <param name="threshold">Vector of values to be used as a threshold for returning 1.</param>
- /// <param name="x">Vector of values to compare against threshold.</param>
- /// <returns>1 if the componentwise comparison x >= threshold is true, otherwise 0.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 step(float3 threshold, float3 x) { return select(float3(0.0f), float3(1.0f), x >= threshold); }
-
- /// <summary>Returns the result of a componentwise step function where each component is 1.0f when x >= threshold and 0.0f otherwise.</summary>
- /// <param name="threshold">Vector of values to be used as a threshold for returning 1.</param>
- /// <param name="x">Vector of values to compare against threshold.</param>
- /// <returns>1 if the componentwise comparison x >= threshold is true, otherwise 0.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 step(float4 threshold, float4 x) { return select(float4(0.0f), float4(1.0f), x >= threshold); }
-
-
- /// <summary>Returns the result of a step function where the result is 1.0f when x >= threshold and 0.0f otherwise.</summary>
- /// <param name="threshold">Values to be used as a threshold for returning 1.</param>
- /// <param name="x">Value to compare against threshold.</param>
- /// <returns>1 if the comparison x >= threshold is true, otherwise 0.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double step(double threshold, double x) { return select(0.0, 1.0, x >= threshold); }
-
- /// <summary>Returns the result of a componentwise step function where each component is 1.0f when x >= threshold and 0.0f otherwise.</summary>
- /// <param name="threshold">Vector of values to be used as a threshold for returning 1.</param>
- /// <param name="x">Vector of values to compare against threshold.</param>
- /// <returns>1 if the componentwise comparison x >= threshold is true, otherwise 0.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 step(double2 threshold, double2 x) { return select(double2(0.0), double2(1.0), x >= threshold); }
-
- /// <summary>Returns the result of a componentwise step function where each component is 1.0f when x >= threshold and 0.0f otherwise.</summary>
- /// <param name="threshold">Vector of values to be used as a threshold for returning 1.</param>
- /// <param name="x">Vector of values to compare against threshold.</param>
- /// <returns>1 if the componentwise comparison x >= threshold is true, otherwise 0.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 step(double3 threshold, double3 x) { return select(double3(0.0), double3(1.0), x >= threshold); }
-
- /// <summary>Returns the result of a componentwise step function where each component is 1.0f when x >= threshold and 0.0f otherwise.</summary>
- /// <param name="threshold">Vector of values to be used as a threshold for returning 1.</param>
- /// <param name="x">Vector of values to compare against threshold.</param>
- /// <returns>1 if the componentwise comparison x >= threshold is true, otherwise 0.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 step(double4 threshold, double4 x) { return select(double4(0.0), double4(1.0), x >= threshold); }
-
-
- /// <summary>Given an incident vector i and a normal vector n, returns the reflection vector r = i - 2.0f * dot(i, n) * n.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <returns>Reflection vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 reflect(float2 i, float2 n) { return i - 2f * n * dot(i, n); }
-
- /// <summary>Given an incident vector i and a normal vector n, returns the reflection vector r = i - 2.0f * dot(i, n) * n.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <returns>Reflection vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 reflect(float3 i, float3 n) { return i - 2f * n * dot(i, n); }
-
- /// <summary>Given an incident vector i and a normal vector n, returns the reflection vector r = i - 2.0f * dot(i, n) * n.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <returns>Reflection vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 reflect(float4 i, float4 n) { return i - 2f * n * dot(i, n); }
-
-
- /// <summary>Given an incident vector i and a normal vector n, returns the reflection vector r = i - 2.0 * dot(i, n) * n.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <returns>Reflection vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 reflect(double2 i, double2 n) { return i - 2 * n * dot(i, n); }
-
- /// <summary>Given an incident vector i and a normal vector n, returns the reflection vector r = i - 2.0 * dot(i, n) * n.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <returns>Reflection vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 reflect(double3 i, double3 n) { return i - 2 * n * dot(i, n); }
-
- /// <summary>Given an incident vector i and a normal vector n, returns the reflection vector r = i - 2.0 * dot(i, n) * n.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <returns>Reflection vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 reflect(double4 i, double4 n) { return i - 2 * n * dot(i, n); }
-
-
- /// <summary>Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <param name="indexOfRefraction">Index of refraction.</param>
- /// <returns>Refraction vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 refract(float2 i, float2 n, float indexOfRefraction)
- {
- float ni = dot(n, i);
- float k = 1.0f - indexOfRefraction * indexOfRefraction * (1.0f - ni * ni);
- return select(0.0f, indexOfRefraction * i - (indexOfRefraction * ni + sqrt(k)) * n, k >= 0);
- }
-
- /// <summary>Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <param name="indexOfRefraction">Index of refraction.</param>
- /// <returns>Refraction vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 refract(float3 i, float3 n, float indexOfRefraction)
- {
- float ni = dot(n, i);
- float k = 1.0f - indexOfRefraction * indexOfRefraction * (1.0f - ni * ni);
- return select(0.0f, indexOfRefraction * i - (indexOfRefraction * ni + sqrt(k)) * n, k >= 0);
- }
-
- /// <summary>Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <param name="indexOfRefraction">Index of refraction.</param>
- /// <returns>Refraction vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 refract(float4 i, float4 n, float indexOfRefraction)
- {
- float ni = dot(n, i);
- float k = 1.0f - indexOfRefraction * indexOfRefraction * (1.0f - ni * ni);
- return select(0.0f, indexOfRefraction * i - (indexOfRefraction * ni + sqrt(k)) * n, k >= 0);
- }
-
-
- /// <summary>Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <param name="indexOfRefraction">Index of refraction.</param>
- /// <returns>Refraction vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 refract(double2 i, double2 n, double indexOfRefraction)
- {
- double ni = dot(n, i);
- double k = 1.0 - indexOfRefraction * indexOfRefraction * (1.0 - ni * ni);
- return select(0.0f, indexOfRefraction * i - (indexOfRefraction * ni + sqrt(k)) * n, k >= 0);
- }
-
- /// <summary>Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <param name="indexOfRefraction">Index of refraction.</param>
- /// <returns>Refraction vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 refract(double3 i, double3 n, double indexOfRefraction)
- {
- double ni = dot(n, i);
- double k = 1.0 - indexOfRefraction * indexOfRefraction * (1.0 - ni * ni);
- return select(0.0f, indexOfRefraction * i - (indexOfRefraction * ni + sqrt(k)) * n, k >= 0);
- }
-
- /// <summary>Returns the refraction vector given the incident vector i, the normal vector n and the refraction index.</summary>
- /// <param name="i">Incident vector.</param>
- /// <param name="n">Normal vector.</param>
- /// <param name="indexOfRefraction">Index of refraction.</param>
- /// <returns>Refraction vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 refract(double4 i, double4 n, double indexOfRefraction)
- {
- double ni = dot(n, i);
- double k = 1.0 - indexOfRefraction * indexOfRefraction * (1.0 - ni * ni);
- return select(0.0f, indexOfRefraction * i - (indexOfRefraction * ni + sqrt(k)) * n, k >= 0);
- }
-
- /// <summary>
- /// Compute vector projection of a onto b.
- /// </summary>
- /// <remarks>
- /// Some finite vectors a and b could generate a non-finite result. This is most likely when a's components
- /// are very large (close to Single.MaxValue) or when b's components are very small (close to FLT_MIN_NORMAL).
- /// In these cases, you can call <see cref="projectsafe(Unity.Mathematics.float2,Unity.Mathematics.float2,Unity.Mathematics.float2)"/>
- /// which will use a given default value if the result is not finite.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <returns>Vector projection of a onto b.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 project(float2 a, float2 ontoB)
- {
- return (dot(a, ontoB) / dot(ontoB, ontoB)) * ontoB;
- }
-
- /// <summary>
- /// Compute vector projection of a onto b.
- /// </summary>
- /// <remarks>
- /// Some finite vectors a and b could generate a non-finite result. This is most likely when a's components
- /// are very large (close to Single.MaxValue) or when b's components are very small (close to FLT_MIN_NORMAL).
- /// In these cases, you can call <see cref="projectsafe(Unity.Mathematics.float3,Unity.Mathematics.float3,Unity.Mathematics.float3)"/>
- /// which will use a given default value if the result is not finite.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <returns>Vector projection of a onto b.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 project(float3 a, float3 ontoB)
- {
- return (dot(a, ontoB) / dot(ontoB, ontoB)) * ontoB;
- }
-
- /// <summary>
- /// Compute vector projection of a onto b.
- /// </summary>
- /// <remarks>
- /// Some finite vectors a and b could generate a non-finite result. This is most likely when a's components
- /// are very large (close to Single.MaxValue) or when b's components are very small (close to FLT_MIN_NORMAL).
- /// In these cases, you can call <see cref="projectsafe(Unity.Mathematics.float4,Unity.Mathematics.float4,Unity.Mathematics.float4)"/>
- /// which will use a given default value if the result is not finite.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <returns>Vector projection of a onto b.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 project(float4 a, float4 ontoB)
- {
- return (dot(a, ontoB) / dot(ontoB, ontoB)) * ontoB;
- }
-
- /// <summary>
- /// Compute vector projection of a onto b. If result is not finite, then return the default value instead.
- /// </summary>
- /// <remarks>
- /// This function performs extra checks to see if the result of projecting a onto b is finite. If you know that
- /// your inputs will generate a finite result or you don't care if the result is finite, then you can call
- /// <see cref="project(Unity.Mathematics.float2,Unity.Mathematics.float2)"/> instead which is faster than this
- /// function.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <param name="defaultValue">Default value to return if projection is not finite.</param>
- /// <returns>Vector projection of a onto b or the default value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 projectsafe(float2 a, float2 ontoB, float2 defaultValue = new float2())
- {
- var proj = project(a, ontoB);
-
- return select(defaultValue, proj, all(isfinite(proj)));
- }
-
- /// <summary>
- /// Compute vector projection of a onto b. If result is not finite, then return the default value instead.
- /// </summary>
- /// <remarks>
- /// This function performs extra checks to see if the result of projecting a onto b is finite. If you know that
- /// your inputs will generate a finite result or you don't care if the result is finite, then you can call
- /// <see cref="project(Unity.Mathematics.float3,Unity.Mathematics.float3)"/> instead which is faster than this
- /// function.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <param name="defaultValue">Default value to return if projection is not finite.</param>
- /// <returns>Vector projection of a onto b or the default value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 projectsafe(float3 a, float3 ontoB, float3 defaultValue = new float3())
- {
- var proj = project(a, ontoB);
-
- return select(defaultValue, proj, all(isfinite(proj)));
- }
-
- /// <summary>
- /// Compute vector projection of a onto b. If result is not finite, then return the default value instead.
- /// </summary>
- /// <remarks>
- /// This function performs extra checks to see if the result of projecting a onto b is finite. If you know that
- /// your inputs will generate a finite result or you don't care if the result is finite, then you can call
- /// <see cref="project(Unity.Mathematics.float4,Unity.Mathematics.float4)"/> instead which is faster than this
- /// function.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <param name="defaultValue">Default value to return if projection is not finite.</param>
- /// <returns>Vector projection of a onto b or the default value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 projectsafe(float4 a, float4 ontoB, float4 defaultValue = new float4())
- {
- var proj = project(a, ontoB);
-
- return select(defaultValue, proj, all(isfinite(proj)));
- }
-
- /// <summary>
- /// Compute vector projection of a onto b.
- /// </summary>
- /// <remarks>
- /// Some finite vectors a and b could generate a non-finite result. This is most likely when a's components
- /// are very large (close to Double.MaxValue) or when b's components are very small (close to DBL_MIN_NORMAL).
- /// In these cases, you can call <see cref="projectsafe(Unity.Mathematics.double2,Unity.Mathematics.double2,Unity.Mathematics.double2)"/>
- /// which will use a given default value if the result is not finite.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <returns>Vector projection of a onto b.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 project(double2 a, double2 ontoB)
- {
- return (dot(a, ontoB) / dot(ontoB, ontoB)) * ontoB;
- }
-
- /// <summary>
- /// Compute vector projection of a onto b.
- /// </summary>
- /// <remarks>
- /// Some finite vectors a and b could generate a non-finite result. This is most likely when a's components
- /// are very large (close to Double.MaxValue) or when b's components are very small (close to DBL_MIN_NORMAL).
- /// In these cases, you can call <see cref="projectsafe(Unity.Mathematics.double3,Unity.Mathematics.double3,Unity.Mathematics.double3)"/>
- /// which will use a given default value if the result is not finite.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <returns>Vector projection of a onto b.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 project(double3 a, double3 ontoB)
- {
- return (dot(a, ontoB) / dot(ontoB, ontoB)) * ontoB;
- }
-
- /// <summary>
- /// Compute vector projection of a onto b.
- /// </summary>
- /// <remarks>
- /// Some finite vectors a and b could generate a non-finite result. This is most likely when a's components
- /// are very large (close to Double.MaxValue) or when b's components are very small (close to DBL_MIN_NORMAL).
- /// In these cases, you can call <see cref="projectsafe(Unity.Mathematics.double4,Unity.Mathematics.double4,Unity.Mathematics.double4)"/>
- /// which will use a given default value if the result is not finite.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <returns>Vector projection of a onto b.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 project(double4 a, double4 ontoB)
- {
- return (dot(a, ontoB) / dot(ontoB, ontoB)) * ontoB;
- }
-
- /// <summary>
- /// Compute vector projection of a onto b. If result is not finite, then return the default value instead.
- /// </summary>
- /// <remarks>
- /// This function performs extra checks to see if the result of projecting a onto b is finite. If you know that
- /// your inputs will generate a finite result or you don't care if the result is finite, then you can call
- /// <see cref="project(Unity.Mathematics.double2,Unity.Mathematics.double2)"/> instead which is faster than this
- /// function.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <param name="defaultValue">Default value to return if projection is not finite.</param>
- /// <returns>Vector projection of a onto b or the default value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 projectsafe(double2 a, double2 ontoB, double2 defaultValue = new double2())
- {
- var proj = project(a, ontoB);
-
- return select(defaultValue, proj, all(isfinite(proj)));
- }
-
- /// <summary>
- /// Compute vector projection of a onto b. If result is not finite, then return the default value instead.
- /// </summary>
- /// <remarks>
- /// This function performs extra checks to see if the result of projecting a onto b is finite. If you know that
- /// your inputs will generate a finite result or you don't care if the result is finite, then you can call
- /// <see cref="project(Unity.Mathematics.double3,Unity.Mathematics.double3)"/> instead which is faster than this
- /// function.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <param name="defaultValue">Default value to return if projection is not finite.</param>
- /// <returns>Vector projection of a onto b or the default value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 projectsafe(double3 a, double3 ontoB, double3 defaultValue = new double3())
- {
- var proj = project(a, ontoB);
-
- return select(defaultValue, proj, all(isfinite(proj)));
- }
-
- /// <summary>
- /// Compute vector projection of a onto b. If result is not finite, then return the default value instead.
- /// </summary>
- /// <remarks>
- /// This function performs extra checks to see if the result of projecting a onto b is finite. If you know that
- /// your inputs will generate a finite result or you don't care if the result is finite, then you can call
- /// <see cref="project(Unity.Mathematics.double4,Unity.Mathematics.double4)"/> instead which is faster than this
- /// function.
- /// </remarks>
- /// <param name="a">Vector to project.</param>
- /// <param name="ontoB">Non-zero vector to project onto.</param>
- /// <param name="defaultValue">Default value to return if projection is not finite.</param>
- /// <returns>Vector projection of a onto b or the default value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 projectsafe(double4 a, double4 ontoB, double4 defaultValue = new double4())
- {
- var proj = project(a, ontoB);
-
- return select(defaultValue, proj, all(isfinite(proj)));
- }
-
- /// <summary>Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.</summary>
- /// <param name="n">Vector to conditionally flip.</param>
- /// <param name="i">First vector in direction comparison.</param>
- /// <param name="ng">Second vector in direction comparison.</param>
- /// <returns>-n if i and ng point in the same direction; otherwise return n unchanged.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 faceforward(float2 n, float2 i, float2 ng) { return select(n, -n, dot(ng, i) >= 0.0f); }
-
- /// <summary>Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.</summary>
- /// <param name="n">Vector to conditionally flip.</param>
- /// <param name="i">First vector in direction comparison.</param>
- /// <param name="ng">Second vector in direction comparison.</param>
- /// <returns>-n if i and ng point in the same direction; otherwise return n unchanged.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 faceforward(float3 n, float3 i, float3 ng) { return select(n, -n, dot(ng, i) >= 0.0f); }
-
- /// <summary>Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.</summary>
- /// <param name="n">Vector to conditionally flip.</param>
- /// <param name="i">First vector in direction comparison.</param>
- /// <param name="ng">Second vector in direction comparison.</param>
- /// <returns>-n if i and ng point in the same direction; otherwise return n unchanged.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 faceforward(float4 n, float4 i, float4 ng) { return select(n, -n, dot(ng, i) >= 0.0f); }
-
-
- /// <summary>Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.</summary>
- /// <param name="n">Vector to conditionally flip.</param>
- /// <param name="i">First vector in direction comparison.</param>
- /// <param name="ng">Second vector in direction comparison.</param>
- /// <returns>-n if i and ng point in the same direction; otherwise return n unchanged.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 faceforward(double2 n, double2 i, double2 ng) { return select(n, -n, dot(ng, i) >= 0.0f); }
-
- /// <summary>Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.</summary>
- /// <param name="n">Vector to conditionally flip.</param>
- /// <param name="i">First vector in direction comparison.</param>
- /// <param name="ng">Second vector in direction comparison.</param>
- /// <returns>-n if i and ng point in the same direction; otherwise return n unchanged.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 faceforward(double3 n, double3 i, double3 ng) { return select(n, -n, dot(ng, i) >= 0.0f); }
-
- /// <summary>Conditionally flips a vector n if two vectors i and ng are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise.</summary>
- /// <param name="n">Vector to conditionally flip.</param>
- /// <param name="i">First vector in direction comparison.</param>
- /// <param name="ng">Second vector in direction comparison.</param>
- /// <returns>-n if i and ng point in the same direction; otherwise return n unchanged.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 faceforward(double4 n, double4 i, double4 ng) { return select(n, -n, dot(ng, i) >= 0.0f); }
-
-
- /// <summary>Returns the sine and cosine of the input float value x through the out parameters s and c.</summary>
- /// <remarks>When Burst compiled, his method is faster than calling sin() and cos() separately.</remarks>
- /// <param name="x">Input angle in radians.</param>
- /// <param name="s">Output sine of the input.</param>
- /// <param name="c">Output cosine of the input.</param>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void sincos(float x, out float s, out float c) { s = sin(x); c = cos(x); }
-
- /// <summary>Returns the componentwise sine and cosine of the input float2 vector x through the out parameters s and c.</summary>
- /// <remarks>When Burst compiled, his method is faster than calling sin() and cos() separately.</remarks>
- /// <param name="x">Input vector containing angles in radians.</param>
- /// <param name="s">Output vector containing the componentwise sine of the input.</param>
- /// <param name="c">Output vector containing the componentwise cosine of the input.</param>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void sincos(float2 x, out float2 s, out float2 c) { s = sin(x); c = cos(x); }
-
- /// <summary>Returns the componentwise sine and cosine of the input float3 vector x through the out parameters s and c.</summary>
- /// <remarks>When Burst compiled, his method is faster than calling sin() and cos() separately.</remarks>
- /// <param name="x">Input vector containing angles in radians.</param>
- /// <param name="s">Output vector containing the componentwise sine of the input.</param>
- /// <param name="c">Output vector containing the componentwise cosine of the input.</param>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void sincos(float3 x, out float3 s, out float3 c) { s = sin(x); c = cos(x); }
-
- /// <summary>Returns the componentwise sine and cosine of the input float4 vector x through the out parameters s and c.</summary>
- /// <remarks>When Burst compiled, his method is faster than calling sin() and cos() separately.</remarks>
- /// <param name="x">Input vector containing angles in radians.</param>
- /// <param name="s">Output vector containing the componentwise sine of the input.</param>
- /// <param name="c">Output vector containing the componentwise cosine of the input.</param>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void sincos(float4 x, out float4 s, out float4 c) { s = sin(x); c = cos(x); }
-
-
- /// <summary>Returns the sine and cosine of the input double value x through the out parameters s and c.</summary>
- /// <remarks>When Burst compiled, his method is faster than calling sin() and cos() separately.</remarks>
- /// <param name="x">Input angle in radians.</param>
- /// <param name="s">Output sine of the input.</param>
- /// <param name="c">Output cosine of the input.</param>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void sincos(double x, out double s, out double c) { s = sin(x); c = cos(x); }
-
- /// <summary>Returns the componentwise sine and cosine of the input double2 vector x through the out parameters s and c.</summary>
- /// <remarks>When Burst compiled, his method is faster than calling sin() and cos() separately.</remarks>
- /// <param name="x">Input vector containing angles in radians.</param>
- /// <param name="s">Output vector containing the componentwise sine of the input.</param>
- /// <param name="c">Output vector containing the componentwise cosine of the input.</param>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void sincos(double2 x, out double2 s, out double2 c) { s = sin(x); c = cos(x); }
-
- /// <summary>Returns the componentwise sine and cosine of the input double3 vector x through the out parameters s and c.</summary>
- /// <remarks>When Burst compiled, his method is faster than calling sin() and cos() separately.</remarks>
- /// <param name="x">Input vector containing angles in radians.</param>
- /// <param name="s">Output vector containing the componentwise sine of the input.</param>
- /// <param name="c">Output vector containing the componentwise cosine of the input.</param>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void sincos(double3 x, out double3 s, out double3 c) { s = sin(x); c = cos(x); }
-
- /// <summary>Returns the componentwise sine and cosine of the input double4 vector x through the out parameters s and c.</summary>
- /// <remarks>When Burst compiled, his method is faster than calling sin() and cos() separately.</remarks>
- /// <param name="x">Input vector containing angles in radians.</param>
- /// <param name="s">Output vector containing the componentwise sine of the input.</param>
- /// <param name="c">Output vector containing the componentwise cosine of the input.</param>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void sincos(double4 x, out double4 s, out double4 c) { s = sin(x); c = cos(x); }
-
-
- /// <summary>Returns number of 1-bits in the binary representation of an int value. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">int value in which to count bits set to 1.</param>
- /// <returns>Number of bits set to 1 within x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int countbits(int x) { return countbits((uint)x); }
-
- /// <summary>Returns component-wise number of 1-bits in the binary representation of an int2 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">int2 value in which to count bits for each component.</param>
- /// <returns>int2 containing number of bits set to 1 within each component of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 countbits(int2 x) { return countbits((uint2)x); }
-
- /// <summary>Returns component-wise number of 1-bits in the binary representation of an int3 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">Number in which to count bits.</param>
- /// <returns>int3 containing number of bits set to 1 within each component of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 countbits(int3 x) { return countbits((uint3)x); }
-
- /// <summary>Returns component-wise number of 1-bits in the binary representation of an int4 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">Number in which to count bits.</param>
- /// <returns>int4 containing number of bits set to 1 within each component of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 countbits(int4 x) { return countbits((uint4)x); }
-
-
- /// <summary>Returns number of 1-bits in the binary representation of a uint value. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">Number in which to count bits.</param>
- /// <returns>Number of bits set to 1 within x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int countbits(uint x)
- {
- x = x - ((x >> 1) & 0x55555555);
- x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
- return (int)((((x + (x >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24);
- }
-
- /// <summary>Returns component-wise number of 1-bits in the binary representation of a uint2 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">Number in which to count bits.</param>
- /// <returns>int2 containing number of bits set to 1 within each component of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 countbits(uint2 x)
- {
- x = x - ((x >> 1) & 0x55555555);
- x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
- return int2((((x + (x >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24);
- }
-
- /// <summary>Returns component-wise number of 1-bits in the binary representation of a uint3 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">Number in which to count bits.</param>
- /// <returns>int3 containing number of bits set to 1 within each component of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 countbits(uint3 x)
- {
- x = x - ((x >> 1) & 0x55555555);
- x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
- return int3((((x + (x >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24);
- }
-
- /// <summary>Returns component-wise number of 1-bits in the binary representation of a uint4 vector. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">Number in which to count bits.</param>
- /// <returns>int4 containing number of bits set to 1 within each component of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 countbits(uint4 x)
- {
- x = x - ((x >> 1) & 0x55555555);
- x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
- return int4((((x + (x >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24);
- }
-
- /// <summary>Returns number of 1-bits in the binary representation of a ulong value. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">Number in which to count bits.</param>
- /// <returns>Number of bits set to 1 within x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int countbits(ulong x)
- {
- x = x - ((x >> 1) & 0x5555555555555555);
- x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333);
- return (int)((((x + (x >> 4)) & 0x0F0F0F0F0F0F0F0F) * 0x0101010101010101) >> 56);
- }
-
- /// <summary>Returns number of 1-bits in the binary representation of a long value. Also known as the Hamming weight, popcnt on x86, and vcnt on ARM.</summary>
- /// <param name="x">Number in which to count bits.</param>
- /// <returns>Number of bits set to 1 within x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int countbits(long x) { return countbits((ulong)x); }
-
-
- /// <summary>Returns the componentwise number of leading zeros in the binary representations of an int vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int lzcnt(int x) { return lzcnt((uint)x); }
-
- /// <summary>Returns the componentwise number of leading zeros in the binary representations of an int2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 lzcnt(int2 x) { return int2(lzcnt(x.x), lzcnt(x.y)); }
-
- /// <summary>Returns the componentwise number of leading zeros in the binary representations of an int3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 lzcnt(int3 x) { return int3(lzcnt(x.x), lzcnt(x.y), lzcnt(x.z)); }
-
- /// <summary>Returns the componentwise number of leading zeros in the binary representations of an int4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 lzcnt(int4 x) { return int4(lzcnt(x.x), lzcnt(x.y), lzcnt(x.z), lzcnt(x.w)); }
-
-
- /// <summary>Returns number of leading zeros in the binary representations of a uint value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int lzcnt(uint x)
- {
- if (x == 0)
- return 32;
- LongDoubleUnion u;
- u.doubleValue = 0.0;
- u.longValue = 0x4330000000000000L + x;
- u.doubleValue -= 4503599627370496.0;
- return 0x41E - (int)(u.longValue >> 52);
- }
-
- /// <summary>Returns the componentwise number of leading zeros in the binary representations of a uint2 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 lzcnt(uint2 x) { return int2(lzcnt(x.x), lzcnt(x.y)); }
-
- /// <summary>Returns the componentwise number of leading zeros in the binary representations of a uint3 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 lzcnt(uint3 x) { return int3(lzcnt(x.x), lzcnt(x.y), lzcnt(x.z)); }
-
- /// <summary>Returns the componentwise number of leading zeros in the binary representations of a uint4 vector.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 lzcnt(uint4 x) { return int4(lzcnt(x.x), lzcnt(x.y), lzcnt(x.z), lzcnt(x.w)); }
-
-
- /// <summary>Returns number of leading zeros in the binary representations of a long value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int lzcnt(long x) { return lzcnt((ulong)x); }
-
-
- /// <summary>Returns number of leading zeros in the binary representations of a ulong value.</summary>
- /// <param name="x">Input value.</param>
- /// <returns>The number of leading zeros of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int lzcnt(ulong x)
- {
- if (x == 0)
- return 64;
-
- uint xh = (uint)(x >> 32);
- uint bits = xh != 0 ? xh : (uint)x;
- int offset = xh != 0 ? 0x41E : 0x43E;
-
- LongDoubleUnion u;
- u.doubleValue = 0.0;
- u.longValue = 0x4330000000000000L + bits;
- u.doubleValue -= 4503599627370496.0;
- return offset - (int)(u.longValue >> 52);
- }
-
- /// <summary>
- /// Computes the trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int tzcnt(int x) { return tzcnt((uint)x); }
-
- /// <summary>
- /// Computes the component-wise trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the component-wise trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 tzcnt(int2 x) { return int2(tzcnt(x.x), tzcnt(x.y)); }
-
- /// <summary>
- /// Computes the component-wise trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the component-wise trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 tzcnt(int3 x) { return int3(tzcnt(x.x), tzcnt(x.y), tzcnt(x.z)); }
-
- /// <summary>
- /// Computes the component-wise trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the component-wise trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 tzcnt(int4 x) { return int4(tzcnt(x.x), tzcnt(x.y), tzcnt(x.z), tzcnt(x.w)); }
-
-
- /// <summary>
- /// Computes the trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int tzcnt(uint x)
- {
- if (x == 0)
- return 32;
-
- x &= (uint)-x;
- LongDoubleUnion u;
- u.doubleValue = 0.0;
- u.longValue = 0x4330000000000000L + x;
- u.doubleValue -= 4503599627370496.0;
- return (int)(u.longValue >> 52) - 0x3FF;
- }
-
- /// <summary>
- /// Computes the component-wise trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the component-wise trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 tzcnt(uint2 x) { return int2(tzcnt(x.x), tzcnt(x.y)); }
-
- /// <summary>
- /// Computes the component-wise trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the component-wise trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 tzcnt(uint3 x) { return int3(tzcnt(x.x), tzcnt(x.y), tzcnt(x.z)); }
-
- /// <summary>
- /// Computes the component-wise trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the component-wise trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 tzcnt(uint4 x) { return int4(tzcnt(x.x), tzcnt(x.y), tzcnt(x.z), tzcnt(x.w)); }
-
- /// <summary>
- /// Computes the trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int tzcnt(long x) { return tzcnt((ulong)x); }
-
- /// <summary>
- /// Computes the trailing zero count in the binary representation of the input value.
- /// </summary>
- /// <remarks>
- /// Assuming that the least significant bit is on the right, the integer value 4 has a binary representation
- /// 0100 and the trailing zero count is two. The integer value 1 has a binary representation 0001 and the
- /// trailing zero count is zero.
- /// </remarks>
- /// <param name="x">Input to use when computing the trailing zero count.</param>
- /// <returns>Returns the trailing zero count of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int tzcnt(ulong x)
- {
- if (x == 0)
- return 64;
-
- x = x & (ulong)-(long)x;
- uint xl = (uint)x;
-
- uint bits = xl != 0 ? xl : (uint)(x >> 32);
- int offset = xl != 0 ? 0x3FF : 0x3DF;
-
- LongDoubleUnion u;
- u.doubleValue = 0.0;
- u.longValue = 0x4330000000000000L + bits;
- u.doubleValue -= 4503599627370496.0;
- return (int)(u.longValue >> 52) - offset;
- }
-
-
-
- /// <summary>Returns the result of performing a reversal of the bit pattern of an int value.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int reversebits(int x) { return (int)reversebits((uint)x); }
-
- /// <summary>Returns the result of performing a componentwise reversal of the bit pattern of an int2 vector.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with componentwise reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 reversebits(int2 x) { return (int2)reversebits((uint2)x); }
-
- /// <summary>Returns the result of performing a componentwise reversal of the bit pattern of an int3 vector.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with componentwise reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 reversebits(int3 x) { return (int3)reversebits((uint3)x); }
-
- /// <summary>Returns the result of performing a componentwise reversal of the bit pattern of an int4 vector.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with componentwise reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 reversebits(int4 x) { return (int4)reversebits((uint4)x); }
-
-
- /// <summary>Returns the result of performing a reversal of the bit pattern of a uint value.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint reversebits(uint x) {
- x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
- x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);
- x = ((x >> 4) & 0x0F0F0F0F) | ((x & 0x0F0F0F0F) << 4);
- x = ((x >> 8) & 0x00FF00FF) | ((x & 0x00FF00FF) << 8);
- return (x >> 16) | (x << 16);
- }
-
- /// <summary>Returns the result of performing a componentwise reversal of the bit pattern of an uint2 vector.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with componentwise reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 reversebits(uint2 x)
- {
- x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
- x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);
- x = ((x >> 4) & 0x0F0F0F0F) | ((x & 0x0F0F0F0F) << 4);
- x = ((x >> 8) & 0x00FF00FF) | ((x & 0x00FF00FF) << 8);
- return (x >> 16) | (x << 16);
- }
-
- /// <summary>Returns the result of performing a componentwise reversal of the bit pattern of an uint3 vector.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with componentwise reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 reversebits(uint3 x)
- {
- x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
- x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);
- x = ((x >> 4) & 0x0F0F0F0F) | ((x & 0x0F0F0F0F) << 4);
- x = ((x >> 8) & 0x00FF00FF) | ((x & 0x00FF00FF) << 8);
- return (x >> 16) | (x << 16);
- }
-
- /// <summary>Returns the result of performing a componentwise reversal of the bit pattern of an uint4 vector.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with componentwise reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 reversebits(uint4 x)
- {
- x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);
- x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);
- x = ((x >> 4) & 0x0F0F0F0F) | ((x & 0x0F0F0F0F) << 4);
- x = ((x >> 8) & 0x00FF00FF) | ((x & 0x00FF00FF) << 8);
- return (x >> 16) | (x << 16);
- }
-
-
- /// <summary>Returns the result of performing a reversal of the bit pattern of a long value.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long reversebits(long x) { return (long)reversebits((ulong)x); }
-
-
- /// <summary>Returns the result of performing a reversal of the bit pattern of a ulong value.</summary>
- /// <param name="x">Value to reverse.</param>
- /// <returns>Value with reversed bits.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong reversebits(ulong x)
- {
- x = ((x >> 1) & 0x5555555555555555ul) | ((x & 0x5555555555555555ul) << 1);
- x = ((x >> 2) & 0x3333333333333333ul) | ((x & 0x3333333333333333ul) << 2);
- x = ((x >> 4) & 0x0F0F0F0F0F0F0F0Ful) | ((x & 0x0F0F0F0F0F0F0F0Ful) << 4);
- x = ((x >> 8) & 0x00FF00FF00FF00FFul) | ((x & 0x00FF00FF00FF00FFul) << 8);
- x = ((x >> 16) & 0x0000FFFF0000FFFFul) | ((x & 0x0000FFFF0000FFFFul) << 16);
- return (x >> 32) | (x << 32);
- }
-
-
- /// <summary>Returns the result of rotating the bits of an int left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int rol(int x, int n) { return (int)rol((uint)x, n); }
-
- /// <summary>Returns the componentwise result of rotating the bits of an int2 left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 rol(int2 x, int n) { return (int2)rol((uint2)x, n); }
-
- /// <summary>Returns the componentwise result of rotating the bits of an int3 left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 rol(int3 x, int n) { return (int3)rol((uint3)x, n); }
-
- /// <summary>Returns the componentwise result of rotating the bits of an int4 left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 rol(int4 x, int n) { return (int4)rol((uint4)x, n); }
-
-
- /// <summary>Returns the result of rotating the bits of a uint left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint rol(uint x, int n) { return (x << n) | (x >> (32 - n)); }
-
- /// <summary>Returns the componentwise result of rotating the bits of a uint2 left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 rol(uint2 x, int n) { return (x << n) | (x >> (32 - n)); }
-
- /// <summary>Returns the componentwise result of rotating the bits of a uint3 left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 rol(uint3 x, int n) { return (x << n) | (x >> (32 - n)); }
-
- /// <summary>Returns the componentwise result of rotating the bits of a uint4 left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 rol(uint4 x, int n) { return (x << n) | (x >> (32 - n)); }
-
-
- /// <summary>Returns the result of rotating the bits of a long left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long rol(long x, int n) { return (long)rol((ulong)x, n); }
-
-
- /// <summary>Returns the result of rotating the bits of a ulong left by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong rol(ulong x, int n) { return (x << n) | (x >> (64 - n)); }
-
-
- /// <summary>Returns the result of rotating the bits of an int right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int ror(int x, int n) { return (int)ror((uint)x, n); }
-
- /// <summary>Returns the componentwise result of rotating the bits of an int2 right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 ror(int2 x, int n) { return (int2)ror((uint2)x, n); }
-
- /// <summary>Returns the componentwise result of rotating the bits of an int3 right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 ror(int3 x, int n) { return (int3)ror((uint3)x, n); }
-
- /// <summary>Returns the componentwise result of rotating the bits of an int4 right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 ror(int4 x, int n) { return (int4)ror((uint4)x, n); }
-
-
- /// <summary>Returns the result of rotating the bits of a uint right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint ror(uint x, int n) { return (x >> n) | (x << (32 - n)); }
-
- /// <summary>Returns the componentwise result of rotating the bits of a uint2 right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 ror(uint2 x, int n) { return (x >> n) | (x << (32 - n)); }
-
- /// <summary>Returns the componentwise result of rotating the bits of a uint3 right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 ror(uint3 x, int n) { return (x >> n) | (x << (32 - n)); }
-
- /// <summary>Returns the componentwise result of rotating the bits of a uint4 right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The componentwise rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 ror(uint4 x, int n) { return (x >> n) | (x << (32 - n)); }
-
-
- /// <summary>Returns the result of rotating the bits of a long right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long ror(long x, int n) { return (long)ror((ulong)x, n); }
-
-
- /// <summary>Returns the result of rotating the bits of a ulong right by bits n.</summary>
- /// <param name="x">Value to rotate.</param>
- /// <param name="n">Number of bits to rotate.</param>
- /// <returns>The rotated value.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong ror(ulong x, int n) { return (x >> n) | (x << (64 - n)); }
-
-
- /// <summary>Returns the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int ceilpow2(int x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x + 1;
- }
-
- /// <summary>Returns the result of a componentwise calculation of the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 ceilpow2(int2 x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x + 1;
- }
-
- /// <summary>Returns the result of a componentwise calculation of the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 ceilpow2(int3 x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x + 1;
- }
-
- /// <summary>Returns the result of a componentwise calculation of the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 ceilpow2(int4 x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x + 1;
- }
-
-
- /// <summary>Returns the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint ceilpow2(uint x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x + 1;
- }
-
- /// <summary>Returns the result of a componentwise calculation of the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 ceilpow2(uint2 x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x + 1;
- }
-
- /// <summary>Returns the result of a componentwise calculation of the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 ceilpow2(uint3 x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x + 1;
- }
-
- /// <summary>Returns the result of a componentwise calculation of the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The componentwise smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 ceilpow2(uint4 x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- return x + 1;
- }
-
-
- /// <summary>Returns the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static long ceilpow2(long x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x |= x >> 32;
- return x + 1;
- }
-
-
- /// <summary>Returns the smallest power of two greater than or equal to the input.</summary>
- /// <remarks>Also known as nextpow2.</remarks>
- /// <param name="x">Input value.</param>
- /// <returns>The smallest power of two greater than or equal to the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ulong ceilpow2(ulong x)
- {
- x -= 1;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x |= x >> 32;
- return x + 1;
- }
-
- /// <summary>
- /// Computes the ceiling of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>
- /// x must be greater than 0, otherwise the result is undefined.
- /// </remarks>
- /// <param name="x">Integer to be used as input.</param>
- /// <returns>Ceiling of the base-2 logarithm of x, as an integer.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int ceillog2(int x)
- {
- return 32 - lzcnt((uint)x - 1);
- }
-
- /// <summary>
- /// Computes the componentwise ceiling of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>
- /// Components of x must be greater than 0, otherwise the result for that component is undefined.
- /// </remarks>
- /// <param name="x">int2 to be used as input.</param>
- /// <returns>Componentwise ceiling of the base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 ceillog2(int2 x)
- {
- return new int2(ceillog2(x.x), ceillog2(x.y));
- }
-
- /// <summary>
- /// Computes the componentwise ceiling of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>
- /// Components of x must be greater than 0, otherwise the result for that component is undefined.
- /// </remarks>
- /// <param name="x">int3 to be used as input.</param>
- /// <returns>Componentwise ceiling of the base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 ceillog2(int3 x)
- {
- return new int3(ceillog2(x.x), ceillog2(x.y), ceillog2(x.z));
- }
-
- /// <summary>
- /// Computes the componentwise ceiling of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>
- /// Components of x must be greater than 0, otherwise the result for that component is undefined.
- /// </remarks>
- /// <param name="x">int4 to be used as input.</param>
- /// <returns>Componentwise ceiling of the base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 ceillog2(int4 x)
- {
- return new int4(ceillog2(x.x), ceillog2(x.y), ceillog2(x.z), ceillog2(x.w));
- }
-
- /// <summary>
- /// Computes the ceiling of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>
- /// x must be greater than 0, otherwise the result is undefined.
- /// </remarks>
- /// <param name="x">Unsigned integer to be used as input.</param>
- /// <returns>Ceiling of the base-2 logarithm of x, as an integer.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int ceillog2(uint x)
- {
- return 32 - lzcnt(x - 1);
- }
-
- /// <summary>
- /// Computes the componentwise ceiling of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>
- /// Components of x must be greater than 0, otherwise the result for that component is undefined.
- /// </remarks>
- /// <param name="x">uint2 to be used as input.</param>
- /// <returns>Componentwise ceiling of the base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 ceillog2(uint2 x)
- {
- return new int2(ceillog2(x.x), ceillog2(x.y));
- }
-
- /// <summary>
- /// Computes the componentwise ceiling of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>
- /// Components of x must be greater than 0, otherwise the result for that component is undefined.
- /// </remarks>
- /// <param name="x">uint3 to be used as input.</param>
- /// <returns>Componentwise ceiling of the base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 ceillog2(uint3 x)
- {
- return new int3(ceillog2(x.x), ceillog2(x.y), ceillog2(x.z));
- }
-
- /// <summary>
- /// Computes the componentwise ceiling of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>
- /// Components of x must be greater than 0, otherwise the result for that component is undefined.
- /// </remarks>
- /// <param name="x">uint4 to be used as input.</param>
- /// <returns>Componentwise ceiling of the base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 ceillog2(uint4 x)
- {
- return new int4(ceillog2(x.x), ceillog2(x.y), ceillog2(x.z), ceillog2(x.w));
- }
-
- /// <summary>
- /// Computes the floor of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>x must be greater than zero, otherwise the result is undefined.</remarks>
- /// <param name="x">Integer to be used as input.</param>
- /// <returns>Floor of base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int floorlog2(int x)
- {
- return 31 - lzcnt((uint)x);
- }
-
- /// <summary>
- /// Computes the componentwise floor of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>Components of x must be greater than zero, otherwise the result of the component is undefined.</remarks>
- /// <param name="x">int2 to be used as input.</param>
- /// <returns>Componentwise floor of base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 floorlog2(int2 x)
- {
- return new int2(floorlog2(x.x), floorlog2(x.y));
- }
-
- /// <summary>
- /// Computes the componentwise floor of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>Components of x must be greater than zero, otherwise the result of the component is undefined.</remarks>
- /// <param name="x">int3 to be used as input.</param>
- /// <returns>Componentwise floor of base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 floorlog2(int3 x)
- {
- return new int3(floorlog2(x.x), floorlog2(x.y), floorlog2(x.z));
- }
-
- /// <summary>
- /// Computes the componentwise floor of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>Components of x must be greater than zero, otherwise the result of the component is undefined.</remarks>
- /// <param name="x">int4 to be used as input.</param>
- /// <returns>Componentwise floor of base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 floorlog2(int4 x)
- {
- return new int4(floorlog2(x.x), floorlog2(x.y), floorlog2(x.z), floorlog2(x.w));
- }
-
- /// <summary>
- /// Computes the floor of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>x must be greater than zero, otherwise the result is undefined.</remarks>
- /// <param name="x">Unsigned integer to be used as input.</param>
- /// <returns>Floor of base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int floorlog2(uint x)
- {
- return 31 - lzcnt(x);
- }
-
- /// <summary>
- /// Computes the componentwise floor of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>Components of x must be greater than zero, otherwise the result of the component is undefined.</remarks>
- /// <param name="x">uint2 to be used as input.</param>
- /// <returns>Componentwise floor of base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 floorlog2(uint2 x)
- {
- return new int2(floorlog2(x.x), floorlog2(x.y));
- }
-
- /// <summary>
- /// Computes the componentwise floor of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>Components of x must be greater than zero, otherwise the result of the component is undefined.</remarks>
- /// <param name="x">uint3 to be used as input.</param>
- /// <returns>Componentwise floor of base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 floorlog2(uint3 x)
- {
- return new int3(floorlog2(x.x), floorlog2(x.y), floorlog2(x.z));
- }
-
- /// <summary>
- /// Computes the componentwise floor of the base-2 logarithm of x.
- /// </summary>
- /// <remarks>Components of x must be greater than zero, otherwise the result of the component is undefined.</remarks>
- /// <param name="x">uint4 to be used as input.</param>
- /// <returns>Componentwise floor of base-2 logarithm of x.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 floorlog2(uint4 x)
- {
- return new int4(floorlog2(x.x), floorlog2(x.y), floorlog2(x.z), floorlog2(x.w));
- }
-
- /// <summary>Returns the result of converting a float value from degrees to radians.</summary>
- /// <param name="x">Angle in degrees.</param>
- /// <returns>Angle converted to radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float radians(float x) { return x * TORADIANS; }
-
- /// <summary>Returns the result of a componentwise conversion of a float2 vector from degrees to radians.</summary>
- /// <param name="x">Vector containing angles in degrees.</param>
- /// <returns>Vector containing angles converted to radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 radians(float2 x) { return x * TORADIANS; }
-
- /// <summary>Returns the result of a componentwise conversion of a float3 vector from degrees to radians.</summary>
- /// <param name="x">Vector containing angles in degrees.</param>
- /// <returns>Vector containing angles converted to radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 radians(float3 x) { return x * TORADIANS; }
-
- /// <summary>Returns the result of a componentwise conversion of a float4 vector from degrees to radians.</summary>
- /// <param name="x">Vector containing angles in degrees.</param>
- /// <returns>Vector containing angles converted to radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 radians(float4 x) { return x * TORADIANS; }
-
-
- /// <summary>Returns the result of converting a float value from degrees to radians.</summary>
- /// <param name="x">Angle in degrees.</param>
- /// <returns>Angle converted to radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double radians(double x) { return x * TORADIANS_DBL; }
-
- /// <summary>Returns the result of a componentwise conversion of a float2 vector from degrees to radians.</summary>
- /// <param name="x">Vector containing angles in degrees.</param>
- /// <returns>Vector containing angles converted to radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 radians(double2 x) { return x * TORADIANS_DBL; }
-
- /// <summary>Returns the result of a componentwise conversion of a float3 vector from degrees to radians.</summary>
- /// <param name="x">Vector containing angles in degrees.</param>
- /// <returns>Vector containing angles converted to radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 radians(double3 x) { return x * TORADIANS_DBL; }
-
- /// <summary>Returns the result of a componentwise conversion of a float4 vector from degrees to radians.</summary>
- /// <param name="x">Vector containing angles in degrees.</param>
- /// <returns>Vector containing angles converted to radians.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 radians(double4 x) { return x * TORADIANS_DBL; }
-
-
- /// <summary>Returns the result of converting a double value from radians to degrees.</summary>
- /// <param name="x">Angle in radians.</param>
- /// <returns>Angle converted to degrees.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float degrees(float x) { return x * TODEGREES; }
-
- /// <summary>Returns the result of a componentwise conversion of a double2 vector from radians to degrees.</summary>
- /// <param name="x">Vector containing angles in radians.</param>
- /// <returns>Vector containing angles converted to degrees.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 degrees(float2 x) { return x * TODEGREES; }
-
- /// <summary>Returns the result of a componentwise conversion of a double3 vector from radians to degrees.</summary>
- /// <param name="x">Vector containing angles in radians.</param>
- /// <returns>Vector containing angles converted to degrees.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 degrees(float3 x) { return x * TODEGREES; }
-
- /// <summary>Returns the result of a componentwise conversion of a double4 vector from radians to degrees.</summary>
- /// <param name="x">Vector containing angles in radians.</param>
- /// <returns>Vector containing angles converted to degrees.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 degrees(float4 x) { return x * TODEGREES; }
-
-
- /// <summary>Returns the result of converting a double value from radians to degrees.</summary>
- /// <param name="x">Angle in radians.</param>
- /// <returns>Angle converted to degrees.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double degrees(double x) { return x * TODEGREES_DBL; }
-
- /// <summary>Returns the result of a componentwise conversion of a double2 vector from radians to degrees.</summary>
- /// <param name="x">Vector containing angles in radians.</param>
- /// <returns>Vector containing angles converted to degrees.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 degrees(double2 x) { return x * TODEGREES_DBL; }
-
- /// <summary>Returns the result of a componentwise conversion of a double3 vector from radians to degrees.</summary>
- /// <param name="x">Vector containing angles in radians.</param>
- /// <returns>Vector containing values converted to degrees.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 degrees(double3 x) { return x * TODEGREES_DBL; }
-
- /// <summary>Returns the result of a componentwise conversion of a double4 vector from radians to degrees.</summary>
- /// <param name="x">Vector containing angles in radians.</param>
- /// <returns>Vector containing angles converted to degrees.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 degrees(double4 x) { return x * TODEGREES_DBL; }
-
-
- /// <summary>Returns the minimum component of an int2 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int cmin(int2 x) { return min(x.x, x.y); }
-
- /// <summary>Returns the minimum component of an int3 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int cmin(int3 x) { return min(min(x.x, x.y), x.z); }
-
- /// <summary>Returns the minimum component of an int4 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int cmin(int4 x) { return min(min(x.x, x.y), min(x.z, x.w)); }
-
-
- /// <summary>Returns the minimum component of a uint2 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint cmin(uint2 x) { return min(x.x, x.y); }
-
- /// <summary>Returns the minimum component of a uint3 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint cmin(uint3 x) { return min(min(x.x, x.y), x.z); }
-
- /// <summary>Returns the minimum component of a uint4 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint cmin(uint4 x) { return min(min(x.x, x.y), min(x.z, x.w)); }
-
-
- /// <summary>Returns the minimum component of a float2 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float cmin(float2 x) { return min(x.x, x.y); }
-
- /// <summary>Returns the minimum component of a float3 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float cmin(float3 x) { return min(min(x.x, x.y), x.z); }
-
- /// <summary>Returns the minimum component of a float4 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float cmin(float4 x) { return min(min(x.x, x.y), min(x.z, x.w)); }
-
-
- /// <summary>Returns the minimum component of a double2 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double cmin(double2 x) { return min(x.x, x.y); }
-
- /// <summary>Returns the minimum component of a double3 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double cmin(double3 x) { return min(min(x.x, x.y), x.z); }
-
- /// <summary>Returns the minimum component of a double4 vector.</summary>
- /// <param name="x">The vector to use when computing the minimum component.</param>
- /// <returns>The value of the minimum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double cmin(double4 x) { return min(min(x.x, x.y), min(x.z, x.w)); }
-
-
- /// <summary>Returns the maximum component of an int2 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int cmax(int2 x) { return max(x.x, x.y); }
-
- /// <summary>Returns the maximum component of an int3 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int cmax(int3 x) { return max(max(x.x, x.y), x.z); }
-
- /// <summary>Returns the maximum component of an int4 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int cmax(int4 x) { return max(max(x.x, x.y), max(x.z, x.w)); }
-
-
- /// <summary>Returns the maximum component of a uint2 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint cmax(uint2 x) { return max(x.x, x.y); }
-
- /// <summary>Returns the maximum component of a uint3 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint cmax(uint3 x) { return max(max(x.x, x.y), x.z); }
-
- /// <summary>Returns the maximum component of a uint4 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint cmax(uint4 x) { return max(max(x.x, x.y), max(x.z, x.w)); }
-
-
- /// <summary>Returns the maximum component of a float2 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float cmax(float2 x) { return max(x.x, x.y); }
-
- /// <summary>Returns the maximum component of a float3 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float cmax(float3 x) { return max(max(x.x, x.y), x.z); }
-
- /// <summary>Returns the maximum component of a float4 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float cmax(float4 x) { return max(max(x.x, x.y), max(x.z, x.w)); }
-
-
- /// <summary>Returns the maximum component of a double2 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double cmax(double2 x) { return max(x.x, x.y); }
-
- /// <summary>Returns the maximum component of a double3 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double cmax(double3 x) { return max(max(x.x, x.y), x.z); }
-
- /// <summary>Returns the maximum component of a double4 vector.</summary>
- /// <param name="x">The vector to use when computing the maximum component.</param>
- /// <returns>The value of the maximum component of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double cmax(double4 x) { return max(max(x.x, x.y), max(x.z, x.w)); }
-
-
- /// <summary>Returns the horizontal sum of components of an int2 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int csum(int2 x) { return x.x + x.y; }
-
- /// <summary>Returns the horizontal sum of components of an int3 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int csum(int3 x) { return x.x + x.y + x.z; }
-
- /// <summary>Returns the horizontal sum of components of an int4 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int csum(int4 x) { return x.x + x.y + x.z + x.w; }
-
-
- /// <summary>Returns the horizontal sum of components of a uint2 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint csum(uint2 x) { return x.x + x.y; }
-
- /// <summary>Returns the horizontal sum of components of a uint3 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint csum(uint3 x) { return x.x + x.y + x.z; }
-
- /// <summary>Returns the horizontal sum of components of a uint4 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint csum(uint4 x) { return x.x + x.y + x.z + x.w; }
-
-
- /// <summary>Returns the horizontal sum of components of a float2 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float csum(float2 x) { return x.x + x.y; }
-
- /// <summary>Returns the horizontal sum of components of a float3 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float csum(float3 x) { return x.x + x.y + x.z; }
-
- /// <summary>Returns the horizontal sum of components of a float4 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float csum(float4 x) { return (x.x + x.y) + (x.z + x.w); }
-
-
- /// <summary>Returns the horizontal sum of components of a double2 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double csum(double2 x) { return x.x + x.y; }
-
- /// <summary>Returns the horizontal sum of components of a double3 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double csum(double3 x) { return x.x + x.y + x.z; }
-
- /// <summary>Returns the horizontal sum of components of a double4 vector.</summary>
- /// <param name="x">The vector to use when computing the horizontal sum.</param>
- /// <returns>The horizontal sum of of components of the vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double csum(double4 x) { return (x.x + x.y) + (x.z + x.w); }
-
- /// <summary>
- /// Computes the square (x * x) of the input argument x.
- /// </summary>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float square(float x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 square(float2 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 square(float3 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 square(float4 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the square (x * x) of the input argument x.
- /// </summary>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double square(double x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double2 square(double2 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double3 square(double3 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static double4 square(double4 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the square (x * x) of the input argument x.
- /// </summary>
- /// <remarks>
- /// Due to integer overflow, it's not always guaranteed that <c>square(x)</c> is positive. For example, <c>square(46341)</c>
- /// will return <c>-2147479015</c>.
- /// </remarks>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int square(int x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <remarks>
- /// Due to integer overflow, it's not always guaranteed that <c>square(x)</c> is positive. For example, <c>square(new int2(46341))</c>
- /// will return <c>new int2(-2147479015)</c>.
- /// </remarks>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int2 square(int2 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <remarks>
- /// Due to integer overflow, it's not always guaranteed that <c>square(x)</c> is positive. For example, <c>square(new int3(46341))</c>
- /// will return <c>new int3(-2147479015)</c>.
- /// </remarks>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int3 square(int3 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <remarks>
- /// Due to integer overflow, it's not always guaranteed that <c>square(x)</c> is positive. For example, <c>square(new int4(46341))</c>
- /// will return <c>new int4(-2147479015)</c>.
- /// </remarks>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static int4 square(int4 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the square (x * x) of the input argument x.
- /// </summary>
- /// <remarks>
- /// Due to integer overflow, it's not always guaranteed that <c>square(x) >= x</c>. For example, <c>square(4294967295u)</c>
- /// will return <c>1u</c>.
- /// </remarks>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint square(uint x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <remarks>
- /// Due to integer overflow, it's not always guaranteed that <c>square(x) >= x</c>. For example, <c>square(new uint2(4294967295u))</c>
- /// will return <c>new uint2(1u)</c>.
- /// </remarks>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 square(uint2 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <remarks>
- /// Due to integer overflow, it's not always guaranteed that <c>square(x) >= x</c>. For example, <c>square(new uint3(4294967295u))</c>
- /// will return <c>new uint3(1u)</c>.
- /// </remarks>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 square(uint3 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Computes the component-wise square (x * x) of the input argument x.
- /// </summary>
- /// <remarks>
- /// Due to integer overflow, it's not always guaranteed that <c>square(x) >= x</c>. For example, <c>square(new uint4(4294967295u))</c>
- /// will return <c>new uint4(1u)</c>.
- /// </remarks>
- /// <param name="x">Value to square.</param>
- /// <returns>Returns the square of the input.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 square(uint4 x)
- {
- return x * x;
- }
-
- /// <summary>
- /// Packs components with an enabled mask to the left.
- /// </summary>
- /// <remarks>
- /// This function is also known as left packing. The effect of this function is to filter out components that
- /// are not enabled and leave an output buffer tightly packed with only the enabled components. A common use
- /// case is if you perform intersection tests on arrays of data in structure of arrays (SoA) form and need to
- /// produce an output array of the things that intersected.
- /// </remarks>
- /// <param name="output">Pointer to packed output array where enabled components should be stored to.</param>
- /// <param name="index">Index into output array where first enabled component should be stored to.</param>
- /// <param name="val">The value to to compress.</param>
- /// <param name="mask">Mask indicating which components are enabled.</param>
- /// <returns>Index to element after the last one stored.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe int compress(int* output, int index, int4 val, bool4 mask)
- {
- if (mask.x)
- output[index++] = val.x;
- if (mask.y)
- output[index++] = val.y;
- if (mask.z)
- output[index++] = val.z;
- if (mask.w)
- output[index++] = val.w;
-
- return index;
- }
-
- /// <summary>
- /// Packs components with an enabled mask to the left.
- /// </summary>
- /// <remarks>
- /// This function is also known as left packing. The effect of this function is to filter out components that
- /// are not enabled and leave an output buffer tightly packed with only the enabled components. A common use
- /// case is if you perform intersection tests on arrays of data in structure of arrays (SoA) form and need to
- /// produce an output array of the things that intersected.
- /// </remarks>
- /// <param name="output">Pointer to packed output array where enabled components should be stored to.</param>
- /// <param name="index">Index into output array where first enabled component should be stored to.</param>
- /// <param name="val">The value to to compress.</param>
- /// <param name="mask">Mask indicating which components are enabled.</param>
- /// <returns>Index to element after the last one stored.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe int compress(uint* output, int index, uint4 val, bool4 mask)
- {
- return compress((int*)output, index, *(int4*)&val, mask);
- }
-
- /// <summary>
- /// Packs components with an enabled mask to the left.
- /// </summary>
- /// <remarks>
- /// This function is also known as left packing. The effect of this function is to filter out components that
- /// are not enabled and leave an output buffer tightly packed with only the enabled components. A common use
- /// case is if you perform intersection tests on arrays of data in structure of arrays (SoA) form and need to
- /// produce an output array of the things that intersected.
- /// </remarks>
- /// <param name="output">Pointer to packed output array where enabled components should be stored to.</param>
- /// <param name="index">Index into output array where first enabled component should be stored to.</param>
- /// <param name="val">The value to to compress.</param>
- /// <param name="mask">Mask indicating which components are enabled.</param>
- /// <returns>Index to element after the last one stored.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe int compress(float* output, int index, float4 val, bool4 mask)
- {
- return compress((int*)output, index, *(int4*)&val, mask);
- }
-
- /// <summary>Returns the floating point representation of a half-precision floating point value.</summary>
- /// <param name="x">The half precision float.</param>
- /// <returns>The single precision float representation of the half precision float.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float f16tof32(uint x)
- {
- const uint shifted_exp = (0x7c00 << 13);
- uint uf = (x & 0x7fff) << 13;
- uint e = uf & shifted_exp;
- uf += (127 - 15) << 23;
- uf += select(0, (128u - 16u) << 23, e == shifted_exp);
- uf = select(uf, asuint(asfloat(uf + (1 << 23)) - 6.10351563e-05f), e == 0);
- uf |= (x & 0x8000) << 16;
- return asfloat(uf);
- }
-
- /// <summary>Returns the floating point representation of a half-precision floating point vector.</summary>
- /// <param name="x">The half precision float vector.</param>
- /// <returns>The single precision float vector representation of the half precision float vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 f16tof32(uint2 x)
- {
- const uint shifted_exp = (0x7c00 << 13);
- uint2 uf = (x & 0x7fff) << 13;
- uint2 e = uf & shifted_exp;
- uf += (127 - 15) << 23;
- uf += select(0, (128u - 16u) << 23, e == shifted_exp);
- uf = select(uf, asuint(asfloat(uf + (1 << 23)) - 6.10351563e-05f), e == 0);
- uf |= (x & 0x8000) << 16;
- return asfloat(uf);
- }
-
- /// <summary>Returns the floating point representation of a half-precision floating point vector.</summary>
- /// <param name="x">The half precision float vector.</param>
- /// <returns>The single precision float vector representation of the half precision float vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 f16tof32(uint3 x)
- {
- const uint shifted_exp = (0x7c00 << 13);
- uint3 uf = (x & 0x7fff) << 13;
- uint3 e = uf & shifted_exp;
- uf += (127 - 15) << 23;
- uf += select(0, (128u - 16u) << 23, e == shifted_exp);
- uf = select(uf, asuint(asfloat(uf + (1 << 23)) - 6.10351563e-05f), e == 0);
- uf |= (x & 0x8000) << 16;
- return asfloat(uf);
- }
-
- /// <summary>Returns the floating point representation of a half-precision floating point vector.</summary>
- /// <param name="x">The half precision float vector.</param>
- /// <returns>The single precision float vector representation of the half precision float vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 f16tof32(uint4 x)
- {
- const uint shifted_exp = (0x7c00 << 13);
- uint4 uf = (x & 0x7fff) << 13;
- uint4 e = uf & shifted_exp;
- uf += (127 - 15) << 23;
- uf += select(0, (128u - 16u) << 23, e == shifted_exp);
- uf = select(uf, asuint(asfloat(uf + (1 << 23)) - 6.10351563e-05f), e == 0);
- uf |= (x & 0x8000) << 16;
- return asfloat(uf);
- }
-
- /// <summary>Returns the result converting a float value to its nearest half-precision floating point representation.</summary>
- /// <param name="x">The single precision float.</param>
- /// <returns>The half precision float representation of the single precision float.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint f32tof16(float x)
- {
- const int infinity_32 = 255 << 23;
- const uint msk = 0x7FFFF000u;
-
- uint ux = asuint(x);
- uint uux = ux & msk;
- uint h = (uint)(asuint(min(asfloat(uux) * 1.92592994e-34f, 260042752.0f)) + 0x1000) >> 13; // Clamp to signed infinity if overflowed
- h = select(h, select(0x7c00u, 0x7e00u, (int)uux > infinity_32), (int)uux >= infinity_32); // NaN->qNaN and Inf->Inf
- return h | (ux & ~msk) >> 16;
- }
-
- /// <summary>Returns the result of a componentwise conversion of a float2 vector to its nearest half-precision floating point representation.</summary>
- /// <param name="x">The single precision float vector.</param>
- /// <returns>The half precision float vector representation of the single precision float vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint2 f32tof16(float2 x)
- {
- const int infinity_32 = 255 << 23;
- const uint msk = 0x7FFFF000u;
-
- uint2 ux = asuint(x);
- uint2 uux = ux & msk;
- uint2 h = (uint2)(asint(min(asfloat(uux) * 1.92592994e-34f, 260042752.0f)) + 0x1000) >> 13; // Clamp to signed infinity if overflowed
- h = select(h, select(0x7c00u, 0x7e00u, (int2)uux > infinity_32), (int2)uux >= infinity_32); // NaN->qNaN and Inf->Inf
- return h | (ux & ~msk) >> 16;
- }
-
- /// <summary>Returns the result of a componentwise conversion of a float3 vector to its nearest half-precision floating point representation.</summary>
- /// <param name="x">The single precision float vector.</param>
- /// <returns>The half precision float vector representation of the single precision float vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint3 f32tof16(float3 x)
- {
- const int infinity_32 = 255 << 23;
- const uint msk = 0x7FFFF000u;
-
- uint3 ux = asuint(x);
- uint3 uux = ux & msk;
- uint3 h = (uint3)(asint(min(asfloat(uux) * 1.92592994e-34f, 260042752.0f)) + 0x1000) >> 13; // Clamp to signed infinity if overflowed
- h = select(h, select(0x7c00u, 0x7e00u, (int3)uux > infinity_32), (int3)uux >= infinity_32); // NaN->qNaN and Inf->Inf
- return h | (ux & ~msk) >> 16;
- }
-
- /// <summary>Returns the result of a componentwise conversion of a float4 vector to its nearest half-precision floating point representation.</summary>
- /// <param name="x">The single precision float vector.</param>
- /// <returns>The half precision float vector representation of the single precision float vector.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static uint4 f32tof16(float4 x)
- {
- const int infinity_32 = 255 << 23;
- const uint msk = 0x7FFFF000u;
-
- uint4 ux = asuint(x);
- uint4 uux = ux & msk;
- uint4 h = (uint4)(asint(min(asfloat(uux) * 1.92592994e-34f, 260042752.0f)) + 0x1000) >> 13; // Clamp to signed infinity if overflowed
- h = select(h, select(0x7c00u, 0x7e00u, (int4)uux > infinity_32), (int4)uux >= infinity_32); // NaN->qNaN and Inf->Inf
- return h | (ux & ~msk) >> 16;
- }
-
- /// <summary>
- /// Generate an orthonormal basis given a single unit length normal vector.
- /// </summary>
- /// <remarks>
- /// This implementation is from "Building an Orthonormal Basis, Revisited"
- /// https://graphics.pixar.com/library/OrthonormalB/paper.pdf
- /// </remarks>
- /// <param name="normal">Unit length normal vector.</param>
- /// <param name="basis1">Output unit length vector, orthogonal to normal vector.</param>
- /// <param name="basis2">Output unit length vector, orthogonal to normal vector and basis1.</param>
- public static void orthonormal_basis(float3 normal, out float3 basis1, out float3 basis2)
- {
- var sign = normal.z >= 0.0f ? 1.0f : -1.0f;
- var a = -1.0f / (sign + normal.z);
- var b = normal.x * normal.y * a;
- basis1.x = 1.0f + sign * normal.x * normal.x * a;
- basis1.y = sign * b;
- basis1.z = -sign * normal.x;
- basis2.x = b;
- basis2.y = sign + normal.y * normal.y * a;
- basis2.z = -normal.y;
- }
-
- /// <summary>
- /// Generate an orthonormal basis given a single unit length normal vector.
- /// </summary>
- /// <remarks>
- /// This implementation is from "Building an Orthonormal Basis, Revisited"
- /// https://graphics.pixar.com/library/OrthonormalB/paper.pdf
- /// </remarks>
- /// <param name="normal">Unit length normal vector.</param>
- /// <param name="basis1">Output unit length vector, orthogonal to normal vector.</param>
- /// <param name="basis2">Output unit length vector, orthogonal to normal vector and basis1.</param>
- public static void orthonormal_basis(double3 normal, out double3 basis1, out double3 basis2)
- {
- var sign = normal.z >= 0.0 ? 1.0 : -1.0;
- var a = -1.0 / (sign + normal.z);
- var b = normal.x * normal.y * a;
- basis1.x = 1.0 + sign * normal.x * normal.x * a;
- basis1.y = sign * b;
- basis1.z = -sign * normal.x;
- basis2.x = b;
- basis2.y = sign + normal.y * normal.y * a;
- basis2.z = -normal.y;
- }
-
- /// <summary>Change the sign of x based on the most significant bit of y [msb(y) ? -x : x].</summary>
- /// <param name="x">The single precision float to change the sign.</param>
- /// <param name="y">The single precision float used to test the most significant bit.</param>
- /// <returns>Returns x with changed sign based on y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float chgsign(float x, float y)
- {
- return asfloat(asuint(x) ^ (asuint(y) & 0x80000000));
- }
-
- /// <summary>Change the sign of components of x based on the most significant bit of components of y [msb(y) ? -x : x].</summary>
- /// <param name="x">The single precision float vector to change the sign.</param>
- /// <param name="y">The single precision float vector used to test the most significant bit.</param>
- /// <returns>Returns vector x with changed sign based on vector y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float2 chgsign(float2 x, float2 y)
- {
- return asfloat(asuint(x) ^ (asuint(y) & 0x80000000));
- }
-
- /// <summary>Change the sign of components of x based on the most significant bit of components of y [msb(y) ? -x : x].</summary>
- /// <param name="x">The single precision float vector to change the sign.</param>
- /// <param name="y">The single precision float vector used to test the most significant bit.</param>
- /// <returns>Returns vector x with changed sign based on vector y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 chgsign(float3 x, float3 y)
- {
- return asfloat(asuint(x) ^ (asuint(y) & 0x80000000));
- }
-
- /// <summary>Change the sign of components of x based on the most significant bit of components of y [msb(y) ? -x : x].</summary>
- /// <param name="x">The single precision float vector to change the sign.</param>
- /// <param name="y">The single precision float vector used to test the most significant bit.</param>
- /// <returns>Returns vector x with changed sign based on vector y.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float4 chgsign(float4 x, float4 y)
- {
- return asfloat(asuint(x) ^ (asuint(y) & 0x80000000));
- }
-
- /// <summary>Returns a uint hash from a block of memory using the xxhash32 algorithm. Can only be used in an unsafe context.</summary>
- /// <param name="pBuffer">A pointer to the beginning of the data.</param>
- /// <param name="numBytes">Number of bytes to hash.</param>
- /// <param name="seed">Starting seed value.</param>
- /// <returns>The 32 bit hash of the input data buffer.</returns>
- public static unsafe uint hash(void* pBuffer, int numBytes, uint seed = 0)
- {
- unchecked
- {
- const uint Prime1 = 2654435761;
- const uint Prime2 = 2246822519;
- const uint Prime3 = 3266489917;
- const uint Prime4 = 668265263;
- const uint Prime5 = 374761393;
-
- uint4* p = (uint4*)pBuffer;
- uint hash = seed + Prime5;
- if (numBytes >= 16)
- {
- uint4 state = new uint4(Prime1 + Prime2, Prime2, 0, (uint)-Prime1) + seed;
-
- int count = numBytes >> 4;
- for (int i = 0; i < count; ++i)
- {
- state += *p++ * Prime2;
- state = (state << 13) | (state >> 19);
- state *= Prime1;
- }
-
- hash = rol(state.x, 1) + rol(state.y, 7) + rol(state.z, 12) + rol(state.w, 18);
- }
-
- hash += (uint)numBytes;
-
- uint* puint = (uint*)p;
- for (int i = 0; i < ((numBytes >> 2) & 3); ++i)
- {
- hash += *puint++ * Prime3;
- hash = rol(hash, 17) * Prime4;
- }
-
- byte* pbyte = (byte*)puint;
- for (int i = 0; i < ((numBytes) & 3); ++i)
- {
- hash += (*pbyte++) * Prime5;
- hash = rol(hash, 11) * Prime1;
- }
-
- hash ^= hash >> 15;
- hash *= Prime2;
- hash ^= hash >> 13;
- hash *= Prime3;
- hash ^= hash >> 16;
-
- return hash;
- }
- }
-
- /// <summary>
- /// Unity's up axis (0, 1, 0).
- /// </summary>
- /// <remarks>Matches [https://docs.unity3d.com/ScriptReference/Vector3-up.html](https://docs.unity3d.com/ScriptReference/Vector3-up.html)</remarks>
- /// <returns>The up axis.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 up() { return new float3(0.0f, 1.0f, 0.0f); } // for compatibility
-
- /// <summary>
- /// Unity's down axis (0, -1, 0).
- /// </summary>
- /// <remarks>Matches [https://docs.unity3d.com/ScriptReference/Vector3-down.html](https://docs.unity3d.com/ScriptReference/Vector3-down.html)</remarks>
- /// <returns>The down axis.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 down() { return new float3(0.0f, -1.0f, 0.0f); }
-
- /// <summary>
- /// Unity's forward axis (0, 0, 1).
- /// </summary>
- /// <remarks>Matches [https://docs.unity3d.com/ScriptReference/Vector3-forward.html](https://docs.unity3d.com/ScriptReference/Vector3-forward.html)</remarks>
- /// <returns>The forward axis.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 forward() { return new float3(0.0f, 0.0f, 1.0f); }
-
- /// <summary>
- /// Unity's back axis (0, 0, -1).
- /// </summary>
- /// <remarks>Matches [https://docs.unity3d.com/ScriptReference/Vector3-back.html](https://docs.unity3d.com/ScriptReference/Vector3-back.html)</remarks>
- /// <returns>The back axis.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 back() { return new float3(0.0f, 0.0f, -1.0f); }
-
- /// <summary>
- /// Unity's left axis (-1, 0, 0).
- /// </summary>
- /// <remarks>Matches [https://docs.unity3d.com/ScriptReference/Vector3-left.html](https://docs.unity3d.com/ScriptReference/Vector3-left.html)</remarks>
- /// <returns>The left axis.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 left() { return new float3(-1.0f, 0.0f, 0.0f); }
-
- /// <summary>
- /// Unity's right axis (1, 0, 0).
- /// </summary>
- /// <remarks>Matches [https://docs.unity3d.com/ScriptReference/Vector3-right.html](https://docs.unity3d.com/ScriptReference/Vector3-right.html)</remarks>
- /// <returns>The right axis.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 right() { return new float3(1.0f, 0.0f, 0.0f); }
-
- /// <summary>
- /// Returns the Euler angle representation of the quaternion following the XYZ rotation order.
- /// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
- /// </summary>
- /// <param name="q">The quaternion to convert to Euler angles.</param>
- /// <returns>The Euler angle representation of the quaternion in XYZ order.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 EulerXYZ(quaternion q)
- {
- const float epsilon = 1e-6f;
- const float cutoff = (1f - 2f * epsilon) * (1f - 2f * epsilon);
-
- // prepare the data
- var qv = q.value;
- var d1 = qv * qv.wwww * float4(2f); //xw, yw, zw, ww
- var d2 = qv * qv.yzxw * float4(2f); //xy, yz, zx, ww
- var d3 = qv * qv;
- var euler = Unity.Mathematics.float3.zero;
-
- var y1 = d2.z - d1.y;
- if (y1 * y1 < cutoff)
- {
- var x1 = d2.y + d1.x;
- var x2 = d3.z + d3.w - d3.y - d3.x;
- var z1 = d2.x + d1.z;
- var z2 = d3.x + d3.w - d3.y - d3.z;
- euler = float3(atan2(x1, x2), -asin(y1), atan2(z1, z2));
- }
- else //xzx
- {
- y1 = clamp(y1, -1f, 1f);
- var abcd = float4(d2.z, d1.y, d2.x, d1.z);
- var x1 = 2f * (abcd.x * abcd.w + abcd.y * abcd.z); //2(ad+bc)
- var x2 = csum(abcd * abcd * float4(-1f, 1f, -1f, 1f));
- euler = float3(atan2(x1, x2), -asin(y1), 0f);
- }
-
- return euler;
- }
-
- /// <summary>
- /// Returns the Euler angle representation of the quaternion following the XZY rotation order.
- /// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
- /// </summary>
- /// <param name="q">The quaternion to convert to Euler angles.</param>
- /// <returns>The Euler angle representation of the quaternion in XZY order.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 EulerXZY(quaternion q)
- {
- const float epsilon = 1e-6f;
- const float cutoff = (1f - 2f * epsilon) * (1f - 2f * epsilon);
-
- // prepare the data
- var qv = q.value;
- var d1 = qv * qv.wwww * float4(2f); //xw, yw, zw, ww
- var d2 = qv * qv.yzxw * float4(2f); //xy, yz, zx, ww
- var d3 = qv * qv;
- var euler = Unity.Mathematics.float3.zero;
-
- var y1 = d2.x + d1.z;
- if (y1 * y1 < cutoff)
- {
- var x1 = -d2.y + d1.x;
- var x2 = d3.y + d3.w - d3.z - d3.x;
- var z1 = -d2.z + d1.y;
- var z2 = d3.x + d3.w - d3.y - d3.z;
- euler = float3(atan2(x1, x2), asin(y1), atan2(z1, z2));
- }
- else //xyx
- {
- y1 = clamp(y1, -1f, 1f);
- var abcd = float4(d2.x, d1.z, d2.z, d1.y);
- var x1 = 2f * (abcd.x * abcd.w + abcd.y * abcd.z); //2(ad+bc)
- var x2 = csum(abcd * abcd * float4(-1f, 1f, -1f, 1f));
- euler = float3(atan2(x1, x2), asin(y1), 0f);
- }
-
- return euler.xzy;
- }
-
- /// <summary>
- /// Returns the Euler angle representation of the quaternion following the YXZ rotation order.
- /// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
- /// </summary>
- /// <param name="q">The quaternion to convert to Euler angles.</param>
- /// <returns>The Euler angle representation of the quaternion in YXZ order.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 EulerYXZ(quaternion q)
- {
- const float epsilon = 1e-6f;
- const float cutoff = (1f - 2f * epsilon) * (1f - 2f * epsilon);
-
- // prepare the data
- var qv = q.value;
- var d1 = qv * qv.wwww * float4(2f); //xw, yw, zw, ww
- var d2 = qv * qv.yzxw * float4(2f); //xy, yz, zx, ww
- var d3 = qv * qv;
- var euler = Unity.Mathematics.float3.zero;
-
- var y1 = d2.y + d1.x;
- if (y1 * y1 < cutoff)
- {
- var x1 = -d2.z + d1.y;
- var x2 = d3.z + d3.w - d3.x - d3.y;
- var z1 = -d2.x + d1.z;
- var z2 = d3.y + d3.w - d3.z - d3.x;
- euler = float3(atan2(x1, x2), asin(y1), atan2(z1, z2));
- }
- else //yzy
- {
- y1 = clamp(y1, -1f, 1f);
- var abcd = float4(d2.x, d1.z, d2.y, d1.x);
- var x1 = 2f * (abcd.x * abcd.w + abcd.y * abcd.z); //2(ad+bc)
- var x2 = csum(abcd * abcd * float4(-1f, 1f, -1f, 1f));
- euler = float3(atan2(x1, x2), asin(y1), 0f);
- }
-
- return euler.yxz;
- }
-
- /// <summary>
- /// Returns the Euler angle representation of the quaternion following the YZX rotation order.
- /// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
- /// </summary>
- /// <param name="q">The quaternion to convert to Euler angles.</param>
- /// <returns>The Euler angle representation of the quaternion in YZX order.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 EulerYZX(quaternion q)
- {
- const float epsilon = 1e-6f;
- const float cutoff = (1f - 2f * epsilon) * (1f - 2f * epsilon);
-
- // prepare the data
- var qv = q.value;
- var d1 = qv * qv.wwww * float4(2f); //xw, yw, zw, ww
- var d2 = qv * qv.yzxw * float4(2f); //xy, yz, zx, ww
- var d3 = qv * qv;
- var euler = Unity.Mathematics.float3.zero;
-
- var y1 = d2.x - d1.z;
- if (y1 * y1 < cutoff)
- {
- var x1 = d2.z + d1.y;
- var x2 = d3.x + d3.w - d3.z - d3.y;
- var z1 = d2.y + d1.x;
- var z2 = d3.y + d3.w - d3.x - d3.z;
- euler = float3(atan2(x1, x2), -asin(y1), atan2(z1, z2));
- }
- else //yxy
- {
- y1 = clamp(y1, -1f, 1f);
- var abcd = float4(d2.x, d1.z, d2.y, d1.x);
- var x1 = 2f * (abcd.x * abcd.w + abcd.y * abcd.z); //2(ad+bc)
- var x2 = csum(abcd * abcd * float4(-1f, 1f, -1f, 1f));
- euler = float3(atan2(x1, x2), -asin(y1), 0f);
- }
-
- return euler.zxy;
- }
-
- /// <summary>
- /// Returns the Euler angle representation of the quaternion following the ZXY rotation order.
- /// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
- /// </summary>
- /// <param name="q">The quaternion to convert to Euler angles.</param>
- /// <returns>The Euler angle representation of the quaternion in ZXY order.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 EulerZXY(quaternion q)
- {
- const float epsilon = 1e-6f;
- const float cutoff = (1f - 2f * epsilon) * (1f - 2f * epsilon);
-
- // prepare the data
- var qv = q.value;
- var d1 = qv * qv.wwww * float4(2f); //xw, yw, zw, ww
- var d2 = qv * qv.yzxw * float4(2f); //xy, yz, zx, ww
- var d3 = qv * qv;
- var euler = Unity.Mathematics.float3.zero;
-
- var y1 = d2.y - d1.x;
- if (y1 * y1 < cutoff)
- {
- var x1 = d2.x + d1.z;
- var x2 = d3.y + d3.w - d3.x - d3.z;
- var z1 = d2.z + d1.y;
- var z2 = d3.z + d3.w - d3.x - d3.y;
- euler = float3(atan2(x1, x2), -asin(y1), atan2(z1, z2));
- }
- else //zxz
- {
- y1 = clamp(y1, -1f, 1f);
- var abcd = float4(d2.z, d1.y, d2.y, d1.x);
- var x1 = 2f * (abcd.x * abcd.w + abcd.y * abcd.z); //2(ad+bc)
- var x2 = csum(abcd * abcd * float4(-1f, 1f, -1f, 1f));
- euler = float3(atan2(x1, x2), -asin(y1), 0f);
- }
-
- return euler.yzx;
- }
-
- /// <summary>
- /// Returns the Euler angle representation of the quaternion following the ZYX rotation order.
- /// All rotation angles are in radians and clockwise when looking along the rotation axis towards the origin.
- /// </summary>
- /// <param name="q">The quaternion to convert to Euler angles.</param>
- /// <returns>The Euler angle representation of the quaternion in ZYX order.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 EulerZYX(quaternion q)
- {
- const float epsilon = 1e-6f;
- const float cutoff = (1f - 2f * epsilon) * (1f - 2f * epsilon);
-
- var qv = q.value;
- var d1 = qv * qv.wwww * float4(2f); //xw, yw, zw, ww
- var d2 = qv * qv.yzxw * float4(2f); //xy, yz, zx, ww
- var d3 = qv * qv;
- var euler = Unity.Mathematics.float3.zero;
-
- var y1 = d2.z + d1.y;
- if (y1 * y1 < cutoff)
- {
- var x1 = -d2.x + d1.z;
- var x2 = d3.x + d3.w - d3.y - d3.z;
- var z1 = -d2.y + d1.x;
- var z2 = d3.z + d3.w - d3.y - d3.x;
- euler = float3(atan2(x1, x2), asin(y1), atan2(z1, z2));
- }
- else //zxz
- {
- y1 = clamp(y1, -1f, 1f);
- var abcd = float4(d2.z, d1.y, d2.y, d1.x);
- var x1 = 2f * (abcd.x * abcd.w + abcd.y * abcd.z); //2(ad+bc)
- var x2 = csum(abcd * abcd * float4(-1f, 1f, -1f, 1f));
- euler = float3(atan2(x1, x2), asin(y1), 0f);
- }
-
- return euler.zyx;
- }
-
- /// <summary>
- /// Returns the Euler angle representation of the quaternion. The returned angles depend on the specified order to apply the
- /// three rotations around the principal axes. All rotation angles are in radians and clockwise when looking along the
- /// rotation axis towards the origin.
- /// When the rotation order is known at compile time, to get the best performance you should use the specific
- /// Euler rotation constructors such as EulerZXY(...).
- /// </summary>
- /// <param name="q">The quaternion to convert to Euler angles.</param>
- /// <param name="order">The order in which the rotations are applied.</param>
- /// <returns>The Euler angle representation of the quaternion in the specified order.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3 Euler(quaternion q, math.RotationOrder order = math.RotationOrder.Default)
- {
- switch (order)
- {
- case math.RotationOrder.XYZ:
- return EulerXYZ(q);
- case math.RotationOrder.XZY:
- return EulerXZY(q);
- case math.RotationOrder.YXZ:
- return EulerYXZ(q);
- case math.RotationOrder.YZX:
- return EulerYZX(q);
- case math.RotationOrder.ZXY:
- return EulerZXY(q);
- case math.RotationOrder.ZYX:
- return EulerZYX(q);
- default:
- return Unity.Mathematics.float3.zero;
- }
- }
-
- /// <summary>
- /// Matrix columns multiplied by scale components
- /// m.c0.x * s.x | m.c1.x * s.y | m.c2.x * s.z
- /// m.c0.y * s.x | m.c1.y * s.y | m.c2.y * s.z
- /// m.c0.z * s.x | m.c1.z * s.y | m.c2.z * s.z
- /// </summary>
- /// <param name="m">Matrix to scale.</param>
- /// <param name="s">Scaling coefficients for each column.</param>
- /// <returns>The scaled matrix.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3x3 mulScale(float3x3 m, float3 s) => new float3x3(m.c0 * s.x, m.c1 * s.y, m.c2 * s.z);
-
- /// <summary>
- /// Matrix rows multiplied by scale components
- /// m.c0.x * s.x | m.c1.x * s.x | m.c2.x * s.x
- /// m.c0.y * s.y | m.c1.y * s.y | m.c2.y * s.y
- /// m.c0.z * s.z | m.c1.z * s.z | m.c2.z * s.z
- /// </summary>
- /// <param name="s">Scaling coefficients for each row.</param>
- /// <param name="m">Matrix to scale.</param>
- /// <returns>The scaled matrix.</returns>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static float3x3 scaleMul(float3 s, float3x3 m) => new float3x3(m.c0 * s, m.c1 * s, m.c2 * s);
-
- // Internal
-
- // SSE shuffles
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static float4 unpacklo(float4 a, float4 b)
- {
- return shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightY);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static double4 unpacklo(double4 a, double4 b)
- {
- return shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightY);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static float4 unpackhi(float4 a, float4 b)
- {
- return shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftW, ShuffleComponent.RightW);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static double4 unpackhi(double4 a, double4 b)
- {
- return shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftW, ShuffleComponent.RightW);
- }
-
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static float4 movelh(float4 a, float4 b)
- {
- return shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.RightX, ShuffleComponent.RightY);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static double4 movelh(double4 a, double4 b)
- {
- return shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.RightX, ShuffleComponent.RightY);
- }
-
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static float4 movehl(float4 a, float4 b)
- {
- return shuffle(b, a, ShuffleComponent.LeftZ, ShuffleComponent.LeftW, ShuffleComponent.RightZ, ShuffleComponent.RightW);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static double4 movehl(double4 a, double4 b)
- {
- return shuffle(b, a, ShuffleComponent.LeftZ, ShuffleComponent.LeftW, ShuffleComponent.RightZ, ShuffleComponent.RightW);
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static uint fold_to_uint(double x) // utility for double hashing
- {
- LongDoubleUnion u;
- u.longValue = 0;
- u.doubleValue = x;
- return (uint)(u.longValue >> 32) ^ (uint)u.longValue;
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static uint2 fold_to_uint(double2 x) { return uint2(fold_to_uint(x.x), fold_to_uint(x.y)); }
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static uint3 fold_to_uint(double3 x) { return uint3(fold_to_uint(x.x), fold_to_uint(x.y), fold_to_uint(x.z)); }
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static uint4 fold_to_uint(double4 x) { return uint4(fold_to_uint(x.x), fold_to_uint(x.y), fold_to_uint(x.z), fold_to_uint(x.w)); }
-
- [StructLayout(LayoutKind.Explicit)]
- internal struct LongDoubleUnion
- {
- [FieldOffset(0)]
- public long longValue;
- [FieldOffset(0)]
- public double doubleValue;
- }
- }
- }
|