Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: A very very simple 3D rendering routine (Almost) - Seeking Help with my code

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default A very very simple 3D rendering routine (Almost) - Seeking Help with my code

    I've been working on this project. The goal is to provide simple routines to project objects in 3D space onto a 2D camera screen. I have found and used sources from the internet to perform some of the calculations. I have attached a screenshot of the output thus far and the project files as created in Net Beans.

    The attached pic may look correct but I do believe its wrong in the fact that its looks lopsided. To debug the program I have first confirmed that the intercept points are correct on the camera screen. From there I have found that there might be an error in how the program calculates the distance of a 3D point to a plane which is used on the camera screen.


    public double point_plane_distance(Vector3D point)
    {
    double e = ((a * point.x) + (b * point.y) + (c * point.z)-d) / Math.sqrt(Math.pow(a,2) + Math.pow(b,2) + Math.pow(c,2));



    return e;
    }

    double x_dist = vertical_offset.point_plane_distance(ip);
    double y_dist = horizontal_offset.point_plane_distance(ip);

    System.out.println("x dist to screen offset: " + x_dist);
    System.out.println("y dist to screen offset: " + y_dist);

    ***

    What I'm looking for is help from other programmers to validate the code and provide feedback on if its actually correct and to provide a solution otherwise. Please feel free to download and unzip the attached source for review.

    Russell Brown
    Toronto Ontario
    Attached Images Attached Images
    Attached Files Attached Files

Similar Threads

  1. Does Java have a timer routine.
    By DenPit5 in forum Java Theory & Questions
    Replies: 4
    Last Post: June 18th, 2014, 09:25 AM
  2. Screen item not appearing when routine called
    By DenPit5 in forum Android Development
    Replies: 5
    Last Post: May 27th, 2014, 11:11 AM
  3. Screen item not appearing when routine called
    By DenPit5 in forum Java Theory & Questions
    Replies: 1
    Last Post: May 27th, 2014, 02:11 AM
  4. seeking who will help
    By Zakariya Kumba in forum Member Introductions
    Replies: 0
    Last Post: November 9th, 2012, 09:29 PM
  5. I Cant seem to get my sort routine to function
    By rrickman9 in forum What's Wrong With My Code?
    Replies: 15
    Last Post: May 22nd, 2011, 07:48 PM