Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3677686
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:15:06+00:00 2026-05-19T03:15:06+00:00

In my current project I have an ArrayList of PVectors that store xyz coordinates

  • 0

In my current project I have an ArrayList of PVectors that store xyz coordinates for 3d points. I’m passing the ArrayList to another class that manipulates it, however, I’m getting a NullPointerException when doing so. I’m assuming that one of the PVectors is null, but I checked for this by assigning any null objects to (0,0,0) and I’m still getting the error. Also, is it more effecient to have an array of PVectors or an ArrayList of PVectors? Either way I’m still getting the error. Here is the line that produces it.

 trip.pass(pointCoordinates); 

And here is the main class

import org.openkinect.*;
import org.openkinect.processing.*;

Kinect kinect;
 Trip trip;

boolean tripOn;

int w = 640;
int h = 480;
int distance = 5; 

float[] depthLookUp = new float[2048];
ArrayList pointCoordinates = new ArrayList();

float factor = 400;
float a = 0;
float angle = 0;
float frequency = .05;

void setup() {
  size(800,600,P3D);
  kinect = new Kinect(this);
  kinect.start();
  kinect.enableDepth(true);
  kinect.processDepthImage(false);
  stroke(255); 
  for (int i = 0; i < depthLookUp.length; i++) {
    depthLookUp[i] = rawDepthToMeters(i);
  }
  for(int i = 0; i < 31920; i++) {
   pointCoordinates.add(new PVector(0, 0, 0));
  }
}

void draw() {
  background(0);
  pushMatrix();
  translate(width/2 + width/3,height/2, -200);
  //add 1/3 width to account for rule of thirds 
  popMatrix();
  int[] depth = kinect.getRawDepth();
  calculate(depth);  
  if(!tripOn) {
   for(int i = 0; i < pointCoordinates.size(); i++) {
     PVector temp = (PVector) pointCoordinates.get(i);
     point(temp.x, temp.y, temp.z);
   }
  }
  if(frameCount % 10 == 0) {
    if(tripOn) {
     tripOn = false;
     trip.clear(); 
    }
    else {
     tripOn = true;
     trip.pass(pointCoordinates); 
   }
  }
  if(tripOn) trip.run();
}

void stop() {
  kinect.quit();
  super.stop();
}

I can paste more classes if it helps to clarify the problem. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:15:07+00:00Added an answer on May 19, 2026 at 3:15 am

    You are not initializing your “trip” variable and therefore a call to trip.pass(..) would throw the NullPointerException.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my current project we have a large repository of content that was originally
I have a spec in my current project that requires us to advise the
I have a short question. Im my current project I'm using LINQ-to-SQl. That is
In my current project I have a few different interfaces that require me to
In my current project I have a custom ViewData that has (amongst others) the
In my current django project I have a model that stores very long strings
For a current MVC3 project I have a model that has multiple pages for
within my current project file I have a user control that has a storyboard
In a current project, I have a model called Box that stores items from
In a current (C#) project we have a 3rd party assembly that contains a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.