• Create Account

# luca-deltodesco

Member Since 10 May 2006
Offline Last Active Sep 07 2013 03:50 PM

### #4780333equation of a plane + point on plane and half width

Posted by on 28 February 2011 - 05:52 PM

[A,B,C] is the normal of the plane,, let's assume it's normal for the sake of simplicity.

you can create two orthogonal tangents by projecting the normal onto it's maximal coordinate plane (for numerical stability) and normalising and rotating it 90 degrees in the plane, the cross product of this and the normal will then give you a second, orthogonal tangent

aka:

```normal = (A,B,C)/sqrt(A^2+B^2+C^2)
m = min{|A| ,|B| ,|C|}
(m==|A|) -> tangent = (0,-C,<img src='http://public.gamedev.net/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' />/sqrt(C^2+B^2)
(m==|B|) -> tangent = (-C,0,A)/sqrt(C^2+A^2)
(m==|C|) -> tangent = (-B,A,0)/sqrt(B^2+A^2)

bitangent = cross(normal,tangent).
```

then each point on the circle of radius R in the plane centred at P would be:

P + R*(cos(theta)*tangent + sin(theta)*bitangent)

### #4772385Inertia matrix woes

Posted by on 10 February 2011 - 09:11 AM

It entirely depends on your object.

A sphere for example, has an infinite number of possible principal axi, it makes no difference which you choose for your basis, so the moment of inertia for a sphere (about the centre of mass) will always be diagonal.

A cuboid on the otherhand, the moment of inertia will only be diagonal when the coordinate axi pass through it's prinicipal axi which are the normals of it's edges, so if your cuboid happens to be axis-aligned with the normal euclidian axis, then you will have a diagonal matrix by using the normal x,y,z axi.

If you want to find the principal axi, then you can form the moment of inertia using the standard x,y,z axi about the centre of mass of the object, then diagonalising it by finding the invertible P such that inv(P)*M*P = D (D diagonal, M your moment of inertia), and P's columns will be the principal axi, with D the new moment of inertia you would get if you formed it using P.

P should consists of linearly independent unit eigenvectors of M, and since M is symmetric, these will be orthogonal => principal axi are orthogonal, you might consider them to be the 'natural' coordinate system for the object.

### #4667982Ray tracer performance

Posted by on 24 June 2010 - 09:58 PM

I've not touched my ray tracer experiment in a few years, it was never meant to be real time, but it was quite feature rich outside of geometry.

Spheres/Boxes/Tori/Cylinders/Cones/Heightmap terrain aswell as any affine transformation. with point lights and directed ponit lights (emmiting light like a cone)
more importantly. CSG operations on the primitives with ability to group objects together and perform multiple CSG operations.

It was more feature rich in terms of shading, you could combine alpha maps and different textures to overlay on the primitives to vary reflective properties, refractive properties at that point of the surface and diffuse/specular properties, and normal maps of course and multisampling for nicer renderings.

And i also got ruond to adding a primitive photon mapping pass.

Uploaded the old screenshots i have to here:http://gust.isjackd.in/luca/drt/

with my favourites being:
http://gust.isjackd.in/luca/drt/terr3.jpg Terrain with a subtracted torus, all nice and reflective with the heightmap using a normal map and a smooth torus surface.

http://gust.isjackd.in/luca/drt/new3.jpg showing some photon mapping.

http://gust.isjackd.in/luca/drt/csg6.jpg cool shape by subtracting a double-cone from a torus.

PARTNERS