473,396 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Question regarding Camera Position in a 3D Scene

Jezternz
145 100+
Okay, so I have setup a scene in Java.
I have 2 points. The first point is always 0,0,0.
The second point is the camera position and can be any positive or negative values for x,y,z.
Now what I want to do is have a function 'centerCameraView' which will modify the camera angle values, and will put the first point (0,0,0) in the center of the camera's view.
So I guess as much as anything I am looking for pseudo code. Any help would be great, even links to other sites, or a good search. I couldn't find anything that really helped.

Cheers, Josh
Oct 5 '09 #1
3 2180
JosAH
11,448 Expert 8TB
@Jezternz
If the camera is positioned at a point (x, y, z) and always 'looks' at the origin O = (0, 0, 0) then you have to translate the subject towards that origin O. A simple translation finds the average of the subject (x', y', z') and uses that vector to translate the subject towards the origin O.

kind regards,

Jos
Oct 6 '09 #2
Jezternz
145 100+
Thanks for the reply Josah,
I am quite new to vector math, so I was wondering if you could give me a bit more detail. When you say average of a vector (subject), do you mean the normalised version of it?
Once I have this, I don't quite get the last line either, what do you mean by translate the subject towards the origin O.
cheers, Josh
Oct 6 '09 #3
JosAH
11,448 Expert 8TB
@Jezternz
Suppose you have a unit cube with one of its corners in the origin O. The average position of the cube is at A = (1/2, 1/2, 1/2). Translate the entire cube over the vector -A so that the origin O will be at the middle of the cube.

In general: for points v_1, v_2 ... v_n, find A = sum(v_i)/n; next translate all v_i over -A, i.e. v_i-A and project those points according to your camera position.

kind regards,

Jos
Oct 7 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Newbie | last post by:
I am doing some robotics projects but my main area of interest is trying out several algorithms for the processing of the stream of data coming from the video. I am wondering what type of camera...
11
by: NS | last post by:
I am relativly new to css positioning and have a question regarding the display of a DHTML pop-up Here is the basic HTML I am using: <html> <head> <script language="JavaScript"> <!--
3
by: Torsten Wiebesiek | last post by:
Hi, I am currently working on a computer vision system. At the moment I'm adding support for firewire cameras. Since there is only one firewire system on a computer, I have writen a firewire...
2
by: Arun Prasath | last post by:
Hi all, I have the following question regd pointer typecasting. Is the following type of pointer typecasting valid? #define ALLOC(type,num) ((type *)malloc(sizeof(type)*num)) /*begin...
3
by: Brad Rogers | last post by:
Ive got a project needing to establish a video stream from a camera connected to a USB port. Is there an established way to call out a camera connection dialog box and assign the stream to the...
2
by: Stupid48 | last post by:
I have this Pentax Optio camera and I want to access it via vb.net. I would like to write something where I can snap the picture from the application and it automatically acquires the image from...
6
by: sb | last post by:
Hi! Imagine a grid that is 4192 bytes wide and 4192 bytes high. Typically, the majority (>65%) of the bytes in the grid equal 0 meaning that they are not used. My goal is to be able to: a)...
1
by: bg_ie | last post by:
I'm designing a database with 3 tables called Function, Test and Scene. A Function has multiple Tests, but a Test has only one Function. A many to many relationship exists between Test and Scene...
1
by: Jason7899 | last post by:
hi, i have seen this internet camera Trendnet TV-IP301 for a good price but i don´t find any significant review of this equipament. i want use this equipament for video surveilance, 356 days/year...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.