js |
JavaScriptタグが付けられた新着投稿 - Qiita |
便利ページ:javascriptで画像をOCRする |
https://qiita.com/poruruba/items/7e4f63588ef10bdea44c
|
以下のGitHubに上げたユーティリティページを更新しています。 |
2021-12-31 20:49:09 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Rails 7.0 + Ruby 3.1でゼロからアプリを作ってみたときにハマったところあれこれ |
https://qiita.com/jnchito/items/5c41a7031404c313da1f
|
バリデーション失敗時のレスポンスにstatusunprocessableentityが付いていないので、ログインに失敗してもエラーメッセージが何も表示されないDELETEリクエストのレスポンスにstatusseeotherが付かないため、ログアウトやアカウント削除のリンクが正常に機能しないルーティングエラーが起きたりするアカウント削除のボタンをクリックしても確認ダイアログが表示されないこのため、僕は一時的な回避策として以下のような対応を取りました。 |
2021-12-31 20:01:39 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
QuickSight の自己プロビジョニングをフェデレーション環境でやってみた マネージメントコンソール編 |
https://qiita.com/sugimount-a/items/a838c84118703527415b
|
AzureADでユーザーを作成するときに、適切なIAMRoleを選択することで、選択したIAMRoleに応じたRoleAdminorAuthororReaderで自己プロビジョニングができました。 |
2021-12-31 20:41:48 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Rails 7.0 + Ruby 3.1でゼロからアプリを作ってみたときにハマったところあれこれ |
https://qiita.com/jnchito/items/5c41a7031404c313da1f
|
バリデーション失敗時のレスポンスにstatusunprocessableentityが付いていないので、ログインに失敗してもエラーメッセージが何も表示されないDELETEリクエストのレスポンスにstatusseeotherが付かないため、ログアウトやアカウント削除のリンクが正常に機能しないルーティングエラーが起きたりするアカウント削除のボタンをクリックしても確認ダイアログが表示されないこのため、僕は一時的な回避策として以下のような対応を取りました。 |
2021-12-31 20:01:39 |
海外TECH |
DEV Community |
Happy New Year! (with p5.js) |
https://dev.to/ashwinscode/happy-new-year-2n3c
|
Happy New Year with p js Happy New Years everyone Here is a small page I made with p js which has interactive fireworks and a countdown to midnightGithub repo is here |
2021-12-31 11:35:35 |
海外TECH |
DEV Community |
Wrap up 2021 with these VS Code extensions |
https://dev.to/pythonbutsnake/wrap-up-2021-with-these-vs-code-extensions-19af
|
Wrap up with these VS Code extensionsVisual Studio Code is arguably the most popular IDE at the moment for quite a while now was no different for this successful code editor The wide range of different features that VS Code allows us to use is what makes it special One of the things that stands out about VS Code is the massive number of extensions it provides you Today we will have a look at some of the distinct VS Code Extensions that every developer should install by the end of this year Visual Studio IntelliCodeThis extension is based on Artificial Intelligence and it recommends code completion automatically It also gives various development features based on Artificial Intelligence Marketplace Link PeacockThis extension adds various colors to different windows of VS Code While working on the front end and back end at the same time you can add different colors to identify which repo you are working on It also helps you add colors in live share and remote integration Marketplace Link Regex PreviewerRegular expressions are often confusing to understand Regex Previewer gives you a separate document similar to your regex The extension provides many examples of comparisons so it is much easier to quickly and accurately regex the various use cases Marketplace Link bloxblox is another incredibly useful extension with a mammoth drop in ready UI snippets All you have to do is just drag and drop the pre made code snippets in your project and save a great amount of time writing code Marketplace Link BookmarksBookmark your code at a certain line with this extension so that you can refer to it later Add the bookmark with the command “ctrl alt k and it is also the same command for toggling the bookmark “ctrl alt l is the command for jumping to the next bookmark and “ctrl alt j is the command for jumping to the previous bookmark Marketplace Link Quokka jsThis extension speeds up development by displaying runtime values in the editor as you code so you can focus on writing code instead of building custom configs Marketplace Link Profile SwitcherProfile Switcher helps you create various profiles on VS code that you can use for different reasons This is a must have extension for those who use VS code for more than one reason You can save specific extensions for each profile as well Marketplace Link SonarLintSonarlint is an outstanding extension for lone workers without a team Basically it detects code quality and code security issues and generates reports for the user Sonarlint can also be used by teams with sonarCube and sonarCloud It has built in rules in it but a developer can also mute rules or add new rules Marketplace LinkIf you are going in without these extensions then you should definitely check out these extensions for better productivity |
2021-12-31 11:08:03 |
海外TECH |
DEV Community |
Matrices and Vectors in Game Development |
https://dev.to/fkkarakurt/matrices-and-vectors-in-game-development-67h
|
Matrices and Vectors in Game DevelopmentGames especially game graphics are made up of a lot of mathematics The mathematics used in game graphics physics and so forth can become quite complex and advanced Having a firm understanding of the different types of mathematics that are used in game development can allow you to have an easier time understanding and implementing the information In this article we review briefly the different types of mathematics that are common in game development One could write an entire book on game math so this article will serve as a quick review of the topics you should be familiar with coming into game development Vectors Vertices and PointsVectors are the fundamental mathematical objects that are used in every D game and game engine Vectors define a direction in virtual space but they can also be used to define points called vertices plural of vertex orientations or even surface normals which are the directions surfaces face For example a triangle is made up of three of these points In game related books the terms vertex and vector are often used synonymously to refer to a virtual point Technically vectors and vertices are different but they are used the same way most of the time in games Vectors are spatial directions and vertices are points of a primitive Vectors come in many types with the most common ones being D D and D A vector is made up of n number of dimensions that describe the total number of axes it uses For example a D vector only has an X and Y axis a D vector has an X Y and Z axis and a D vector has the same axes as a D vector in addition to a W axis A vector can generally be written as shown below V V V Vn In a language such as C or C a D vector can have the following structures struct VectorD float x y z struct VectorD float pos Vectors can be operated on by scalars which are floating point values For example you can add subtract multiply and divide a vector with another vector or a scalar Adding a vector to a scalar A can be written as shown below V x V x V xV y V y V yV z V z V zV x V x A V y V y AV z V z AThe same goes for subtraction multiplication and division of vectors with other vectors or scalars The length of a vector also known as the vector s magnitude is very common in computer graphics A vector with a magnitude of is called a unit length vector or just unit vector and it refers to a vector that is perpendicular to a point on a surface The magnitude can be calculated as shown below Magnitude Square Root V x V y V z To create a unit vector from a non unit vector all that needs to occur is dividing the vector s magnitude by the vector itself This is shown below where the square root of the square of each added component is divided by the vector V V Square Root V x V y V z A normal refers to a unit length vector Turning a vector into a unit vector is known as normalization and is a highly common operation in computer graphics Other very common operations are the dot product and cross product vector operations The dot product of two vectors also known as the scalar product calculates the difference between the directions the two vectors are pointing The dot product is used to calculate the cosine angle between vectors without using the cosine mathematical formula which can be more CPU expensive and the result is not another vector but a scalar value This calculation is used to perform lighting methods I will write another detailed article on lighting To calculate the dot product multiply each component of the two vectors then add them together This is shown below d V x V x V y V y V z V z The equations used in this article follow the order of operations when calculating values For example multiplication occurs before addition and subtraction Being able to find the angle of difference between two vectors is useful in lighting which we look at later If the dot product between two vectors is the two vectors are perpendicular to one another and are orthogonal Another thing to note is that the sign of the dot product tells us what side one vector is to another If the sign is negative the second vector is behind the first if it is positive then it is in front If it is they are perpendicular The cross product of two vectors also known as the vector product is used to find a new vector that is perpendicular to two tangent vectors This is commonly used to find the direction a polygon is facing by normalizing the cross product of the edge vectors of a triangle The cross product is calculated by multiplying the cross components together and then adding them all together component by component This is shown below To find a triangle s normal for example we first find two edge vectors This is done by calculating a vector between the first and second point of a triangle and normalizing the result edge and by doing the same things with the first and third points of the same triangle The next step is to find the cross product of these two vectors and normalize the results to find the surface s normal The direction of the normal depends on the order in which the vertices were defined If the vertices are clockwise the direction will point in the opposite direction that it would point if they were counterclockwise even though it is the same information That equation shows how to find a polygon s normal e normalize V V e normalize V V normal normalize cross product e e To find a normal of a polygon you only need three points which form a perpendicular triangle to the surface Even if the polygon has more than three points you only need three to find the normal This assumes that all points fall perpendicular to the polygon s plane TransformationsWhen data is submitted in a D game the information is passed to the graphics hardware as D data This data must be processed in a way so that it can be displayed onto a D view which is the screen During the rendering process of the rendering pipeline various coordinate spaces are used together to perform this task D computer graphics incorporate the idea of many different coordinate spaces A coordinate space represents an object s relationship to the rest of the scene For example the vertices of a D model are often stored in object space which is a space local to the model itself To render out an object that is in object space it must be transformed to the worldspace position at which you want to render it World space is the virtual position and orientation rotation of D models in the scene It is efficient to specify geometry in one space and then convert it whenever necessary during the rendering process Say you have two boxes that you want to draw in a D scene If these boxes are identical it would not be efficient to have two or more boxes loaded into memory with different vertex positions if you can just load one box and position it throughout the scene as many times as necessary As another example imagine that you have a complex scene that you ve created and you want to change the positions of objects throughout the scene Being able to position these object space models is more efficient than trying to alter the individual points of every model that was specified in world space When rendering objects in a D scene we use positions and orientations to represent how an object is located This information is used to create a mathematical matrix that can be used to transform the vertex data of rendered geometry from one space to another The positions and orientation which we ll call orientation for short are specified in worldspace which is also known as model space Once an object in object space is transformed to world space it is transformed to screen space which corresponds to the X and Y axes that are aligned to the screen Since the D information has depth and distance with objects that are farther from the camera a projection is applied to the geometry to add perspective to the data The projection matrices that are used on geometry are called homogeneous clip space matrices which clip the geometry to the boundaries of the screen to which they are being rendered Two types of projection are generally used in video games orthogonal projection and perspective projection By altering the projection matrix you can alter the field of view and other properties of the view to create different visual effects such as a fish eye lens for example You can also apply a view to the world matrix to account for a virtual camera position and orientation This is known as the world view or model view matrix Orthogonal projection maps a D object to a D view but objects remain the same size regardless of their distance from the camera In perspective projection perspective is added to the rendered scene which makes objects smaller as they move farther from the camera A comparison of orthogonal and perspective projection is shown below where both scenes use the exact same information but different projections Perspective projection uses a horizon which represents the vanishing point of the view These coordinate spaces are represented by matrices Matrices have the ability to be concatenated together into one matrix For example if the world space matrix is combined with the eye space matrix it is the model view matrix and can be used to transform geometric object space models directly into eyespace Combining the world view camera and projection together gives you the model view projection matrix which is used to transform a vertex into screen space Other spaces such as texture space tangent space and light space for example are normally used when performing a number of special effects such as bump mapping shadow mapping and so on In D games matrices have a lot of uses and are very important Vectors and matrices are among the most important topics to understand in video games and game graphics MatricesA matrix is a mathematical structure that is used in computer graphics to store information about a space In computer graphics matrices are often used for storing orientations translations scaling coordinate spaces and more In game development we usually work with x and x matrices A matrix is essentially a table for example float matrixx matrixx matrixx matrixx matrixx matrixx matrixx matrixx matrixx matrixx A matrix is a table that can be represented in code as a D array or as a set of vectors Matrices with the same number of rows as columns are called square matrices A vector can be considered a D array whereas a matrix can be considered an array of vectors that together represent a space For example a matrix can be created out of three D vectors as follows struct Matrix VectorD col VectorD col VectorD col struct Matrix VectorD mat When it comes to orientations in video games a matrix is used to store rotational and positional information along with scaling Mathematically matrices can be added and subtracted by other matrices of the same size by performing each operation on their equivalent table elements This can be seen as follows M M M M M M Multiplying matrices is not as straightforward as adding or subtracting To multiply each matrix start by multiplying the first element in the first row in matrix A by the first element in the first column in matrix B The result of this operation is stored in the first column s first element in a new matrix let s call it N This continues until every element has been processed in the matrices Travel along the first matrix s rows and along the second matrix s columns To be multiplied matrices must have the same number of rows and columns which is not referring to square matrices specifically When it comes to multiplication it is not commutative with matrices and they preserve the determinant Multiplying matrices works as follows new mat m r c m r c m r c m r c m r c m r c new mat m r c m r c m r c m r c m r c m r c new mat m r c m r c m r c m r c m r c m r c new mat new mat m r c m r c m r c m r c m r c m r c new mat m r c m r c m r c m r c m r c m r c new mat m r c m r c m r c m r c m r c m r c new mat new mat m r c m r c m r c m r c m r c m r c new mat m r c m r c m r c m r c m r c m r c new mat m r c m r c m r c m r c m r c m r c new mat new mat m r c m r c m r c m r c m r c m r c new mat m r c m r c m r c m r c m r c m r c new mat m r c m r c m r c m r c m r c m r c new mat A matrix is considered an identity matrix if the elements starting from the first element going downward in a diagonal direction are set to As we will discuss later if we transform a vector against an identity matrix then nothing will change since we will be literally multiplying the components of a vector by which does not change the value An example of an identity matrix is as follows matrix matrix matrix matrix matrix matrix matrix matrix matrix matrix matrix matrix matrix matrix matrix matrix You can calculate the transpose of a matrix by swapping its rows and columns The determinant of a matrix is like the length of a vector You can only find the determinant of a square matrix which has the same number of rows and columns Matrices that have a nonzero determinant can be inverted For a matrix to be inverted not only does it have to be a square matrix but it cannot contain a row with all zeros A vector can be transformed by a matrix by multiplying the vector against the matrix This is used in the rendering pipeline to convert vectors from one space to another When you multiply a vector by a matrix you are applying the matrix s information to the vector This occurs as follows VectorD out out x v x matrix v y matrix v z matrix matrix out y v x matrix v y matrix v z matrix matrix out z v x matrix v y matrix v z matrix matrix A matrix can be used to store a translation position In computer graphics x matrices are used to store the scaling and rotational information but if another row is added for example if we create a x or have a x matrix the last row can literally store the X Y and Z positional information To translate a matrix set the last row to the position you want This is shown in the following pseudo code assuming M is an array that represents the matrix M X M Y M Z M A vector can be scaled by a matrix Check out the examples we made By multiplying a vector against the matrix we would have effectively multiplied each component of the vector with the three values in the matrix that represent the X Y and Z axes If each of these elements in the matrix is equal to that is the same as multiplying a vector by which does not change its value However a value other than scales the vector with values less than making it smaller and values greater than making it larger If you are working with matrices in video games these three elements of a matrix are used to store the scaling information An example of a scaling matrix the x part of a x matrix is as follows mat scale val mat mat mat mat scale val mat mat mat mat scale val You can also use matrices for rotations To perform rotations in D you need at least a x matrix Rotations can be performed around an axis or arbitrary axes When you multiply a vector by a matrix that stores rotation values it rotates the vector based on that information This can be seen as follows where you can rotate along the X Y and Z axes by creating a rotation matrix void Rotate float matrix double angle float x float y float z float sine float sin angle float cosine float cos angle float sinAngle float sin angle float cosAngle float cos angle float oneSubCos f cosAngle matrix x x oneSubCos cosAngle matrix x y oneSubCos z sinAngle matrix x z oneSubCos y sinAngle matrix y x oneSubCos sinAngle z matrix y y oneSubCos cosAngle matrix y z oneSubCos x sinAngle matrix z x oneSubCos y sinAngle matrix z y oneSubCos x sinAngle matrix z z oneSubCos cosAngle Note that cos ɑ sin ɑ which means the vector is not scaled by the matrices that are strictly rotation matrices If a scale is added that information is added to the rotational information which applies both operations on a vector Rotations and translations are among the most common uses for matrices in computer graphics along with representing coordinate spaces |
2021-12-31 11:05:15 |
Apple |
AppleInsider - Frontpage News |
Apple's October 2021 in review: MacBook Pro, Apple Watch, and shipping delays |
https://appleinsider.com/articles/21/10/31/macbook-pro-apple-watch-and-shipping-delays----october-2021-in-review?utm_medium=rss
|
Apple x s October in review MacBook Pro Apple Watch and shipping delaysYou wait a year for a new processor and then two come along at once October is going to be remembered for the launch of the M Max and M Pro MacBook Pro but there was so much more too October wasn t just about the MacBook Pro but they are superbIn the month when Facebook changed its name and absolutely nothing that addressed a single one of its problems Apple followed its great August by finally releasing what no one had been begging for You can now say Hey Siri play a playlist for when I m waiting for my new MacBook Pro and UPS adds weeks to the shipping Read more |
2021-12-31 11:15:34 |
海外TECH |
WIRED |
Save Money on Subscriptions Thanks to This iOS Loophole |
https://www.wired.com/story/iphone-subscriptions-save-money
|
trick |
2021-12-31 12:00:00 |
海外TECH |
WIRED |
Covid Will Become Endemic. The World Must Decide What That Means |
https://www.wired.com/story/covid-will-become-endemic-the-world-must-decide-what-that-means
|
tolerate |
2021-12-31 12:00:00 |
海外TECH |
WIRED |
The 18 TV Shows We’re Most Looking Forward to in 2022 |
https://www.wired.com/story/most-anticipated-tv-2022
|
targaryen |
2021-12-31 12:00:00 |
海外TECH |
WIRED |
Advice to Startup Founders: Prepare to Fail |
https://www.wired.com/story/2021-startup-founder-advice-books
|
companies |
2021-12-31 12:00:00 |
ニュース |
BBC News - Home |
London teen homicides: Boy's stabbing is record 30th killing |
https://www.bbc.co.uk/news/uk-england-london-59836010?at_medium=RSS&at_campaign=KARANGA
|
previous |
2021-12-31 11:50:36 |
北海道 |
北海道新聞 |
年またぎ寒気、各地に大雪 元日にかけて交通障害警戒 |
https://www.hokkaido-np.co.jp/article/629191/
|
交通障害 |
2021-12-31 20:16:10 |
北海道 |
北海道新聞 |
人民元相場、21年は2・6%高 輸出堅調で2年連続上昇 |
https://www.hokkaido-np.co.jp/article/629209/
|
外国為替市場 |
2021-12-31 20:07:00 |
北海道 |
北海道新聞 |
在日米軍、入国直後に検査実施へ クラスター批判で方針転換 |
https://www.hokkaido-np.co.jp/article/629197/
|
在日米軍 |
2021-12-31 20:06:03 |
北海道 |
北海道新聞 |
中国、米ウォルマートを非難 新疆産品の販売停止で |
https://www.hokkaido-np.co.jp/article/629204/
|
非難 |
2021-12-31 20:02:10 |
北海道 |
北海道新聞 |
世界最高齢のコンドル死ぬ 東山動植物園、60歳以上か |
https://www.hokkaido-np.co.jp/article/629208/
|
名古屋市 |
2021-12-31 20:01:00 |
コメント
コメントを投稿