• Create Account

# coltdaniel

Member Since 12 Jul 2009
Offline Last Active Nov 07 2015 02:40 PM

### Understanding procedure to create normals from a cloud point.

25 October 2015 - 08:39 PM

Hello, I am doing some experiment with point cloud visualization, and found a procedure to generate normals from these
point clouds. The idea is to use the points to generate the normal. The problem is that I may be misunderstanding what should be done. For instance, if I have two points with coordinates (0,0,5) and (0,0,10), so I expected the normal to be (0,0,1), in that way the point can be "reached" by taking the normal and multiplying it by a constant, but what I am getting it is a (1,0,0) or a (0,1,0) normal that can never "reach" neither of these points, so that's why I think I am doing something wrong.
I attached an screenshot of the procedure, and here I will simulate my calculations done with these two points, so hopefully someone will be able to see a mistake.

Here is the screenshot:

Here is the simulation: H = [ || (0,0,5) - (0,0,5) || / 2 ] + [ || (0,0,10) - (0,0,5)|| / 2 ]
H = 0 + 2.5 = 2.5
Wp (0,0,5) = e ^ [ (|| (0,0,5) - (0,0,5) ||) / 2.5² ] = e^0 = 1
Wp (0,0,10) = e ^ [ (|| (0,0,10) - (0,0,5) ||) / 2.5² ] = e^(5/6.25) = e^0.8 =~ 2.22
Mp = (Wp (0,0,5) * (0,0,5) + Wp (0,0,10) * (0,0,10)) / Wp (0,0,5) + Wp (0,0,10)
= [1 * (0,0,5) + 3.22 * (0,0,10)] / 1 + 2,22 = (0,0,37.2) / 3.22 = (0,0,11.55)

C = | (0,0,5) - (0,0,11.55) | = (0,0,-6.55) Inverse C = | (0,0) |
| (0,0,10) - (0,0,11.55) | = (0,0,-1.55) | (0,0) |
| (-6.55,-1.55) |

Inverse C * C = |0 0 0 | eigenvalues = 0, 0, 45.307
|0 0 0 |
|0 0 45.3| eigenvectors = (1,0,0) (0,1,0) (0,0,1)

normal = (1,0,0) or (0,1,0)

Anyone saw anything wrong ?

### Possible shadow artifact on the caster in a ray-tracer.

18 January 2015 - 05:49 PM

Hello, I am doing a Ray-tracer and I may be getting an visual artifact in a scene with a sphere projecting shadow on a plane. Here is:

As can be seen in the above screenshot, it is like the shadow is also projected in the bottom of the sphere in a reduced form. I checked all the calculations in a point located in this shadowed region to see if I could locate the source and my conclusions are this: The problem ain't during the first, direct bounce because the dot product between the light vector and normal is negative. This makes sense, since the light source is exactly above the sphere, aligned with it's center, so if the plane below the sphere wasn't reflective, all the bottom part of the sphere would be in the dark. Ok, then in the first reflection, the ray intersects the plane as expected, but the ray-sphere intersection algorithm says that a intersection happens, I checked the values one by one and everything seems fine. So where can be the error? After some thought I am starting to think that may not be one, that what this intersection means is that the ray hits the plane in a point where it is in the shadow due to the sphere, so none of it's red color hits the bottom of the sphere. But the image seems so unnatural that I am in doubt. What you guys think? Thanks for any suggestions.

### Reverse normal in ray-plane intersection

24 November 2014 - 12:10 AM

Hello, I am trying to do ray-plane intersection based on this siggraph material: http://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm and there the tutorial says that if the dot product between the ray direction and the plane normal is greater than zero then it usually should be reversed.

Why? Since I don't know yet the reason, I also don't know if I can reverse it soon after the first intersection test for the first pixel and then forget about it, or if I can reverse it once only for the intersection rays (I am using orthographic projection, so the ray's direction is always 0,0,1) and then for reflection/refraction rays should I do the dot product test everytime?

Someone could do the favor of clarify that out for me?

### Changing color background

03 February 2013 - 10:39 PM

There is a way to do this? The white background is very irritating to the eyes when I am in a fairly dark environment (which is all the cases of myself acessing it). There is a way to use the old blue background?

### Problem with arrayList

23 November 2009 - 03:40 PM

I Have this program: It creates a federation that controls a series of tournaments, which are disputed and the points should go to the players according to their position in the tournament. I use an arraylist in which the players are positioned there based in the round of the tournament in which they lose. The loser of the first quarterfinal is putted in position 0, the one that loses in the second quarterfinal in position 1, and so on until the champion in the eight position. Here is part of code of this program: (this is most of the main class)
```[sourcelang="java"]
import java.util.ArrayList;

public class Federation {

private int tournamentNumber;
private ArrayList <Tournament> tournamentManager = new ArrayList<Tournament>();

public static void main(String[] args) {
Federation federation = new Federation();
federation.controlActivities();
}

public void controlActivities() {
tournamentManager.get(0).playTournament(this.tournamentManager.get(0).getListPlayers());
this.updatePontuation(this.tournamentManager.get(0).getListPositions(), 0);
tournamentManager.get(1).playTournament(this.tournamentManager.get(1).getListPlayers());
this.updatePontuation(this.tournamentManager.get(1).getListPositions(), 1);
}

private void updatePontuation(ArrayList <Player> positionList, int tournamentNumber) {
int points;
System.out.println (positionList.get(0).getPoints());
System.out.println (positionList.get(1).getPoints());
System.out.println (positionList.get(2).getPoints());
System.out.println (positionList.get(3).getPoints());
System.out.println (positionList.get(4).getPoints());
System.out.println (positionList.get(5).getPoints());
System.out.println (positionList.get(6).getPoints());
System.out.println (positionList.get(7).getPoints());
System.out.println (tournamentManager.get(0).getSemiFinalistPoints());
System.out.println (tournamentManager.get(1).getSemiFinalistPoints());
points = positionList.get(0).getPoints() + this.tournamentManager.get(tournamentNumber).getQuarterFinalistPoints();
positionList.get(0).updatePoints(points);
System.out.println (positionList.get(0).getName());
System.out.println (positionList.get(0).getPoints());
points = positionList.get(1).getPoints() + this.tournamentManager.get(tournamentNumber).getQuarterFinalistPoints();
positionList.get(1).updatePoints(points);
System.out.println (positionList.get(1).getName());
System.out.println (positionList.get(1).getPoints());
points = positionList.get(2).getPoints() + this.tournamentManager.get(tournamentNumber).getQuarterFinalistPoints();
positionList.get(2).updatePoints(points);
System.out.println (positionList.get(2).getName());
System.out.println (positionList.get(2).getPoints());
points = positionList.get(3).getPoints() + this.tournamentManager.get(tournamentNumber).getQuarterFinalistPoints();
positionList.get(3).updatePoints(points);
System.out.println (positionList.get(3).getName());
System.out.println (positionList.get(3).getPoints());
points = positionList.get(4).getPoints() + this.tournamentManager.get(tournamentNumber).getSemiFinalistPoints();
positionList.get(4).updatePoints(points);
System.out.println (positionList.get(4).getName());
System.out.println (positionList.get(4).getPoints());
points = positionList.get(5).getPoints() + this.tournamentManager.get(tournamentNumber).getSemiFinalistPoints();
positionList.get(5).updatePoints(points);
System.out.println (positionList.get(5).getName());
System.out.println (positionList.get(5).getPoints());
points = positionList.get(6).getPoints() + this.tournamentManager.get(tournamentNumber).getViceChampionPoints();
positionList.get(6).updatePoints(points);
System.out.println (positionList.get(6).getName());
System.out.println (positionList.get(6).getPoints());
points = positionList.get(7).getPoints() + this.tournamentManager.get(tournamentNumber).getChampionPoints();
positionList.get(7).updatePoints(points);
System.out.println (positionList.get(7).getName());
System.out.println (positionList.get(7).getPoints());
}

}

}

```
When I execute the first tournament, everything goes just fine, the players are putted in there as they should be and the points are distributed correctly. But when I put the code to execute the second event,
```[sourcelang="java"]
tournamentManager.get(1).playTournament(this.tournamentManager.get(1).getListPlayers());
this.updatePontuation(this.tournamentManager.get(1).getListPositions(), 1);

```
it simply does not sum the points that a player got from the new tournament to its old ones. This is a call to the method that updates the points of a certain player in its constructor:
```[sourcelang="java"]
positionList.get(2).updatePoints(points);

```
And this is the method:
```[sourcelang="java"]
public void updatePoints(int points) {
this.points = points;
}

```
In fact, the points of the old one are erased. Here is the source code from another class that deals with the positioning of a player based on whether he wins the match or nott:
```[sourcelang="java"]
private ArrayList <Player> positionList = new ArrayList<Player>();
Match match7 = new Match(match5.getWinner(), match6.getWinner());
match7.decideMatch ();
match7.showWinner  ();
this.updatePositionList (0, match7);
this.updatePositionList (1, match7);
}

public void updatePositionList (int decide, Match match) {
if (decide == 0)