xnewix's Profile User Rating: -----

Reputation: 2 Apprentice
Active Posts:
201 (0.11 per day)
23-May 09
Profile Views:
Last Active:
User is online 6 minutes ago
Viewing Topic: Linked List and QuadTrees

Previous Fields

OS Preference:
Favorite Browser:
Internet Explorer
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

Icon   xnewix has not set their status

Posts I've Made

  1. In Topic: Linked List and QuadTrees

    Posted 1 Aug 2014

    thanks for the replies.


    Hi. Since you are using 3d points I was wondering if you need an Octree.

    I had considered it, but after doing a bit of reading decided that I would first like to implement the quadtree. If i'm honest my knowledge of pointers isn't too great, so one step at a time :) although i do not think that there is a vast difference between the two.
  2. In Topic: Problem using SDL_FreeSurface

    Posted 31 Jul 2014

    what is this, and why does it come before init() ?

    Button myButton(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 200, 125);

    is this another class that you haven't posted? is this all of your code?
  3. In Topic: 2D Rpg

    Posted 12 Jul 2014

    Well I sure haven't updated this in a while. I've pretty much been working on the same project now for the last year.

    I am currently I'm focusing on terrain generation. I have tried several methods but have settled on a grid of fans. I am happy with the way the terrain looks, for now, but am still having problems with performance.

    The performance increases have come from merging co-planer triangles within a 2*2 square. Unfortunately I haven't come across any explanations of how to reciprocate this effect over a larger area, so although this cuts out some of the unnecessary triangles, it leaves a lot in that could otherwise be merged.

    I'm no longer using .bmp image files as height-maps, this was mainly due to the ungodly amount of space they took up on my disk and the parsing was soooo slow. Now i'm just using binary .HGT files which are at least 1/10th of the size. The .HGT files are data representing the elevation of the earth in meters, and the length along the ground measures at 90 meters per square. For more info search Shuttle Radar Topography Mission (SRTM).

    I have also implemented vertex normal lighting, or at least my distorted interpretation of it, which I think has improved the quality of the terrain significantly, see image from 5 posts back for comparison. Although in places the output can look blurry. I'm not sure if this is something to do with the way I calculated vertex normal's or some other factor I set in the lighting attributes.

    Posted Image

    Posted Image

    I breifly tried to implement a algorimtm to change the colour of the terrain depending on its gradient, but ran into lots of maths problems. From what I remember it was a similar method to my vertex normal calculator with an additional step thrown in to consider the terrain heights. I only seamed to work for extremes which wasn't what I wanted, areas such as the alps where being shaded as having a gentle gradient......seriously it was naff.

    I have also been working on several other mini projects too, one being a parser to load Open Street Map Data, although this has taken more time than I wished. I'm not too keen on the format that the data is in and on top of that it can be quite hit and miss on finding an area of the world that is complete. I have kind of postponed this one for now as I got distracted by the possibility of procedural building generation.....yeah that went right over my head too.
  4. In Topic: Normal Calculations

    Posted 17 Apr 2014

    I do, at least I think I do.

    the numbers are references to which points to use in the calculation of a normal.


    assignnormal(0,1,2); uses point3d[0], point3d[1] and point3d[2]

    consider this grid. where 0 has co-ordinates (x,y,x) (0,0,0)

    6 7 8
    3 4 5
    0 1 2

    (0,0,2) (1,0,2) (2,0,2)
    (0,0,1) (1,0,1) (2,0,1)
    (0,0,0) (1,0,0) (2,0,0)

    therefore, using assignnormal(0,1,2);

    v1 =0
    v2 =1
    v3 =2

    double u_x = point3d[v2].getx()-point3d[v1].getx();

    double u_x = point3d[1].x - point3d[0].x

    point3d[1].x = 1 and point3d[0].x = 0

    the normal function then outputs this to the Point3d resultantnormal
    where the values are stored into

        void assignnormal(int v1, int v2, int v3) {

    std::vector<Point3d> tempnormals;

    i don't pass straight to the point3d[i].normal[0] as I need to find the average of all adjacent normals.
  5. In Topic: Normal Calculations

    Posted 17 Apr 2014

    Yes, it compiles.

    The mesh is a 1201*1201 grid of points.
    The aim was to take 8 other point surrounding a central point and calculate its average normal.

    p8 p1 p2
    p7 A p3
    p6 p5 p4

    so to calculate the normal here I calculate normals using


    the vertexnormal function is where this happens.
    but first the code decides how many points are surrounding the central point A.

    reason being, if A was the bottom left of the grid, i.e point3d[0] then there are no points to the left or under it.
    no p8,p7,p6.... p5 or p4

    once it has been decided on the number of adjacent points, the referance of each of those points is stored in tempids.
    so for the bottom right the ids should be stored as...

    tempid[0] = 0
    tempid[1] = 1201
    tempid[2] = 1202
    tempid[3] = 1

    then I call the assignnormal function to calculate normals using the values

    // this is my first mistake. there is no 4 id.

    assignnormal(0,1,2); use points 0, 1201, 1202
    assignnormal(0,2,3); use points 0, 1202, 1
    assignnormal(0,3,4); use points 0, 1, non
    assignnormal(0,4,1); use points 0, non, 1201

    // should be?

    assignnormal(0,1,2); use points 0, 1201, 1202
    assignnormal(0,2,3); use points 0, 1202, 1
    assignnormal(0,3,1); use points 0, 1, 1201

    // second mistake,
    assign normal function uses ints which are then passed to the normal function.
    the normal function uses v1,v2,v3


    so only the points 0,1,2,3,4,5,6,7,8 will ever be used out of 1,442,401
    this should probably be....


    also I question calculating a normal using 0,3,1

    The output I get with sqrt in normal function.

    with: point i = -1#INF, -1#INF, -1#INF

    without: point i = 000

My Information

Member Title:
D.I.C Head
Age Unknown
Birthday Unknown

Contact Information

Click here to e-mail me
Website URL:
Website URL  http://ageofgreeks.darkbb.com/forum.htm



Page 1 of 1
  1. Photo

    ce0swald Icon

    23 Jun 2010 - 19:15
    FYI... Your website is down.
Page 1 of 1