Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# aabb box rotate

// Calculate the position of the four corners in world space by applying
// The world matrix to the four corners in object space (0, 0, width, height)
Vector2 tl = Vector2.Transform(Vector2.Zero, matrix);
Vector2 tr = Vector2.Transform(new Vector2(extents.x, 0), matrix);
Vector2 bl = Vector2.Transform(new Vector2(0, extents.y), matrix);
Vector2 br = Vector2.Transform(extents, matrix);

// Find the minimum and maximum "corners" based on the ones above
float minX = Min(tl.X, Min(tr.X, Min(bl.X, br.X)));
float maxX = Max(tl.X, Max(tr.X, Max(bl.X, br.X)));
float minY = Min(tl.Y, Min(tr.Y, Min(bl.Y, br.Y)));
float maxY = Max(tl.Y, Max(tr.Y, Max(bl.Y, br.Y)));
Vector2 min = new Vector2(minX, minY);
Vector2 max = new Vector2(maxX, maxY);

// And create the AABB
RectangleF aabb = new RectangleF(min, max - min);
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to perform drop down when click on combobox in c# net 
Csharp :: select every second row in html table 
Csharp :: pass viewbag using ienumerable 
Csharp :: c# skip debug attribute 
Csharp :: Custom Encrypted String Type 
Csharp :: c# run program as an administrator 
Csharp :: qget ViewSchedule revit api 
Csharp :: convert enum to keyvalue 
Csharp :: multidimensional meaning 
Csharp :: edit opened excel file directly 
Csharp :: how to use a round image unity 
Csharp :: what is the difference between rotation rotation axis and equator 
Csharp :: C# check control type 
Csharp :: C# resize window without title bar 
Csharp :: dispose await task c# 
Csharp :: c# use meditor from service 
Csharp :: streamwriter delete all text 
Csharp :: unity eventtrigger blocks scrollview 
Csharp :: c# alert message 
Csharp :: how to add an embedded resource in visual studio code 
Csharp :: unity script wait 
Csharp :: query into complex object using dapper 
Csharp :: C# system dont let write txt file 
Csharp :: how to integrate a c# and angular 9 
Csharp :: revision1 
Csharp :: C# Fibonacci list 
Csharp :: vb.net convert int32 into boolean array stack overflow 
Csharp :: c# sprintf equivalent 
Csharp :: xml reader attributes 
Csharp :: c# how to debig 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =