r3vcam

r3vcam

Class

real/code/r3vcam.h

Library

r3code

Description:

Viewcam Class. This object stores amd manages view window orientation and computes transformations between view pixel coordinates and 3D space coordinates using the input plane system. Notes: - Camera space can be defined by R3VCA_CoordSys, where the third axis defines the direction of the camera and the first axis is horizon from right to left (orthogonal second axis then points up).

See Also

oops/r3model.h oops/r3coords.h oops/r3matrix.h oops/r3gfx.h

Super Class

r3Model

R3CLID_MODEL

JavaScript

r3Vcam

Class Identifier

R3CLID_VCAM - 71

Methods

DO3DTO2D, DO3DTO2DARRAY, DO2DTO3D, DO2DTO3DARRAY, SETNATIVEORIENTATION, GOTONATIVEORIENTATION, ROTATE, SETALLHOTPOINTS, DO2DTODIRPOINT, DO3DTO2DANDSIGN, CLIPLINE, DO2DFLOATTO3D, ROTATETOMAIN, CLIPFARLINE, CLIPLINEGENERAL, VIEWTOMODEL,

Attributes

Projection, Width, Height, AspectRatio, Position, Aimpoint, Heading, Pitching, Banking, IPlaneHeading, IPlanePitching, IPlaneBanking, Scale, CoordSys, IPCoordSys, Distance, Hotpoint, ModelView, ViewIPAngle, KeepIPlaneOrthogonal, RelHeading, RelPitching, RelBanking, RelIPlaneHeading, RelIPlanePitching, RelIPlaneBanking, NativeCoordSys, MinClipDist, MaxClipDist, PrivateHotp, NoVertPersp,

Registration

int R3RegisterVCamClass(R3APP *app);

R3VCM_DO3DTO2D

Method

DO3DTO2D

Identifier

R3VCM_DO3DTO2D

JavaScript

obj.DO3DTO2D();

Description

Map 3D point to 2D

R3VCM_DO3DTO2DARRAY

Method

DO3DTO2DARRAY

Identifier

R3VCM_DO3DTO2DARRAY

JavaScript

obj.DO3DTO2DARRAY();

Description

Map an array of 3D points to 2D. Init. vcammsg's count field to reflect the point count.

R3VCM_DO2DTO3D

Method

DO2DTO3D

Identifier

R3VCM_DO2DTO3D

Return

R3BOOL, return true if z > 0 (the point is not behind the camera )

JavaScript

rc = obj.DO2DTO3D();

Description

Map 2D point to 3D

R3VCM_DO2DTO3DARRAY

Method

DO2DTO3DARRAY

Identifier

R3VCM_DO2DTO3DARRAY

JavaScript

obj.DO2DTO3DARRAY();

Description

Map an array of 2D points to 3D

R3VCM_SETNATIVEORIENTATION

Method

SETNATIVEORIENTATION

Identifier

R3VCM_SETNATIVEORIENTATION

JavaScript

obj.SETNATIVEORIENTATION();

Description

Sets the current orientation of camera as the native orientation

R3VCM_GOTONATIVEORIENTATION

Method

GOTONATIVEORIENTATION

Identifier

R3VCM_GOTONATIVEORIENTATION

JavaScript

obj.GOTONATIVEORIENTATION();

Description

resets the camera to its native orientation

R3VCM_ROTATE

Method

ROTATE

Identifier

R3VCM_ROTATE

Param 1:

R3FLOAT, amount of horiz. rotation in radians

Param 2:

R3FLOAT, amount of vert. rotation in radians

Param 3:

R3INT, rotate flags as defined below, defines what to rotate

JavaScript

obj.ROTATE(p1, p2, p3);

Description

rotates camera in its native orientation

R3VCCM_SETALLHOTPOINTS

Method

SETALLHOTPOINTS

Identifier

R3VCCM_SETALLHOTPOINTS

Param 3:

R3VECTOR, the new hot point position

JavaScript

obj.SETALLHOTPOINTS(p3);

Description

sets the hotpoint to a common value

R3VCM_DO2DTODIRPOINT

Method

DO2DTODIRPOINT

Identifier

R3VCM_DO2DTODIRPOINT

JavaScript

obj.DO2DTODIRPOINT();

Description

maps a 2d sceen coordinate to a point on orthogonal plane at unit distance from the camera

R3VCM_DO3DTO2DANDSIGN

Method

DO3DTO2DANDSIGN

Identifier

R3VCM_DO3DTO2DANDSIGN

JavaScript

obj.DO3DTO2DANDSIGN();

Description

projects a point to the screen coords. Positive t coord indicates if it was in front of the camera.

R3VCM_CLIPLINE

Method

CLIPLINE

Identifier

R3VCM_CLIPLINE

Param 3:

R3VECTOR, result vector. p3->r & s will contain the screen coords.

JavaScript

obj.CLIPLINE(p3);

Description

finds the screen coords of the point where the given line goes through minclipdist plane

R3VCM_DO2DFLOATTO3D

Method

DO2DFLOATTO3D

Identifier

R3VCM_DO2DFLOATTO3D

JavaScript

obj.DO2DFLOATTO3D();

Description

maps a 2d screen coordinate (on floating point form) to input plane

R3VCM_ROTATETOMAIN

Method

ROTATETOMAIN

Identifier

R3VCM_ROTATETOMAIN

Param 1:

R3INT, rotate flags

Param 3:

R3INT, see rotate directions below

JavaScript

obj.ROTATETOMAIN(p1, p3);

Description

Rotates from current view to closest main native projection axis direction

R3VCM_CLIPFARLINE

Method

CLIPFARLINE

Identifier

R3VCM_CLIPFARLINE

Param 3:

R3VECTOR, result vector. p3->r & s will contain the screen coords.

JavaScript

obj.CLIPFARLINE(p3);

Description

finds the screen coords of the point where the given line goes through maxclipdist plane

R3VCM_CLIPLINEGENERAL

Method

CLIPLINEGENERAL

Identifier

R3VCM_CLIPLINEGENERAL

JavaScript

obj.CLIPLINEGENERAL();

Description

finds the screen coords of the point where the given line goes through a clip plane

R3VCM_VIEWTOMODEL

Method

VIEWTOMODEL

Identifier

R3VCM_VIEWTOMODEL

Param 1:

R3VECTOR, input point

Param 3:

R3VECTOR, point in abs. world space

JavaScript

obj.VIEWTOMODEL(p1, p3);

Description

Map a 3d point defined in view space to 3d point in abs. world space.

R3VCM_ROTATETOMAIN direction types:

R3VCAM_ROTATEUP
R3VCAM_ROTATEDOWN
R3VCAM_ROTATELEFT
R3VCAM_ROTATERIGHT

Flags for ROTATE method

R3VCROTATE_CAMERA
R3VCROTATE_IPLANE
R3VCROTATE_BANK
R3VCROTATE_ABOUTVP

Projection

Attribute

Projection

Identifier

R3VCA_Projection

JavaScript type

Integer

C type

R3INT

Description

see projection codes below

Syntax


jsobj.SetProjection(value);
value = jsobj.GetProjection();


R3INT value = ...;
R3SetAttrs(r3obj, R3VCA_Projection, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3VCA_Projection, &value, R3TAG_END);

Width

Attribute

Width

Identifier

R3VCA_Width

JavaScript type

Integer

C type

R3INT

Description

width in pixels

Syntax


jsobj.SetWidth(value);
value = jsobj.GetWidth();


R3INT value = ...;
R3SetAttrs(r3obj, R3VCA_Width, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3VCA_Width, &value, R3TAG_END);

Height

Attribute

Height

Identifier

R3VCA_Height

JavaScript type

Integer

C type

R3INT

Description

height in pixels

Syntax


jsobj.SetHeight(value);
value = jsobj.GetHeight();


R3INT value = ...;
R3SetAttrs(r3obj, R3VCA_Height, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3VCA_Height, &value, R3TAG_END);

AspectRatio

Attribute

AspectRatio

Identifier

R3VCA_AspectRatio

JavaScript type

Number

C type

R3FLOAT

Description

Pixel aspect ratio height/width.

Syntax


jsobj.SetAspectRatio(value);
value = jsobj.GetAspectRatio();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_AspectRatio, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_AspectRatio, &value, R3TAG_END);

Position

Attribute

Position

Identifier

R3VCA_Position

Type

r3Vect

Description

the origin of R3VCA_CoordSys

Syntax


jsobj.SetPosition(value);
value = jsobj.GetPosition();


R3VECTOR value = ...;
R3SetAttrs(r3obj, R3VCA_Position, value, R3TAG_END);
R3VECTOR value;
R3GetAttrs(r3obj, R3VCA_Position, &value, R3TAG_END);

Aimpoint

Attribute

Aimpoint

Identifier

R3VCA_Aimpoint

Type

r3Vect

Description

The point camera is aimin at and arouind which camera rotates

Syntax


jsobj.SetAimpoint(value);
value = jsobj.GetAimpoint();


R3VECTOR value = ...;
R3SetAttrs(r3obj, R3VCA_Aimpoint, value, R3TAG_END);
R3VECTOR value;
R3GetAttrs(r3obj, R3VCA_Aimpoint, &value, R3TAG_END);

Heading

Attribute

Heading

Identifier

R3VCA_Heading

JavaScript type

Number

C type

R3FLOAT

Description

Heading for camera oriented angle controls

Syntax


jsobj.SetHeading(value);
value = jsobj.GetHeading();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_Heading, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_Heading, &value, R3TAG_END);

Pitching

Attribute

Pitching

Identifier

R3VCA_Pitching

JavaScript type

Number

C type

R3FLOAT

Description

Pitcing for camera oriented angle controls

Syntax


jsobj.SetPitching(value);
value = jsobj.GetPitching();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_Pitching, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_Pitching, &value, R3TAG_END);

Banking

Attribute

Banking

Identifier

R3VCA_Banking

JavaScript type

Number

C type

R3FLOAT

Description

Banking for camera orientated angle controls

Syntax


jsobj.SetBanking(value);
value = jsobj.GetBanking();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_Banking, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_Banking, &value, R3TAG_END);

IPlaneHeading

Attribute

IPlaneHeading

Identifier

R3VCA_IPlaneHeading

JavaScript type

Number

C type

R3FLOAT

Description

angle controls for iplane orientation

Syntax


jsobj.SetIPlaneHeading(value);
value = jsobj.GetIPlaneHeading();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_IPlaneHeading, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_IPlaneHeading, &value, R3TAG_END);

IPlanePitching

Attribute

IPlanePitching

Identifier

R3VCA_IPlanePitching

JavaScript type

Number

C type

R3FLOAT

Description

angle controls for iplane orientation

Syntax


jsobj.SetIPlanePitching(value);
value = jsobj.GetIPlanePitching();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_IPlanePitching, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_IPlanePitching, &value, R3TAG_END);

IPlaneBanking

Attribute

IPlaneBanking

Identifier

R3VCA_IPlaneBanking

JavaScript type

Number

C type

R3FLOAT

Description

angle controls for iplane orientation

Syntax


jsobj.SetIPlaneBanking(value);
value = jsobj.GetIPlaneBanking();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_IPlaneBanking, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_IPlaneBanking, &value, R3TAG_END);

Scale

Attribute

Scale

Identifier

R3VCA_Scale

JavaScript type

Number

C type

R3FLOAT

Description

zoom scale = 1/width of visible area at unit distance from cam origin

Syntax


jsobj.SetScale(value);
value = jsobj.GetScale();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_Scale, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_Scale, &value, R3TAG_END);

CoordSys

Attribute

CoordSys

Identifier

R3VCA_CoordSys

Type

r3Coordsys

Description

camera space

Syntax


jsobj.SetCoordSys(value);
value = jsobj.GetCoordSys();


R3COORDSYS value = ...;
R3SetAttrs(r3obj, R3VCA_CoordSys, &value, R3TAG_END);
R3COORDSYS value;
R3GetAttrs(r3obj, R3VCA_CoordSys, &value, R3TAG_END);

IPCoordSys

Attribute

IPCoordSys

Identifier

R3VCA_IPCoordSys

Type

r3Coordsys

Description

input space

Syntax


jsobj.SetIPCoordSys(value);
value = jsobj.GetIPCoordSys();


R3COORDSYS value = ...;
R3SetAttrs(r3obj, R3VCA_IPCoordSys, &value, R3TAG_END);
R3COORDSYS value;
R3GetAttrs(r3obj, R3VCA_IPCoordSys, &value, R3TAG_END);

Distance

Attribute

Distance

Identifier

R3VCA_Distance

JavaScript type

Number

C type

R3FLOAT

Description

point of interest (around which camera rotates) is orig + distance*normal

Syntax


jsobj.SetDistance(value);
value = jsobj.GetDistance();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_Distance, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_Distance, &value, R3TAG_END);

Hotpoint

Attribute

Hotpoint

Identifier

R3VCA_Hotpoint

Type

r3Vect

Description

origin of IPCoordSys

Syntax


jsobj.SetHotpoint(value);
value = jsobj.GetHotpoint();


R3VECTOR value = ...;
R3SetAttrs(r3obj, R3VCA_Hotpoint, value, R3TAG_END);
R3VECTOR value;
R3GetAttrs(r3obj, R3VCA_Hotpoint, &value, R3TAG_END);

ModelView

Attribute

ModelView

Identifier

R3VCA_ModelView

Type

r3Matrix

Description

read-only

Syntax


value = jsobj.GetModelView();


R3MATRIX value;
R3GetAttrs(r3obj, R3VCA_ModelView, &value, R3TAG_END);

ViewIPAngle

Attribute

ViewIPAngle

Identifier

R3VCA_ViewIPAngle

JavaScript type

Number

C type

R3FLOAT

Description

read-only, dot product of iplane normal and cam dir

Syntax


value = jsobj.GetViewIPAngle();


R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_ViewIPAngle, &value, R3TAG_END);

KeepIPlaneOrthogonal

Attribute

KeepIPlaneOrthogonal

Identifier

R3VCA_KeepIPlaneOrthogonal

JavaScript type

Boolean

C type

R3BOOL

Description

if TRUE iplane is always kept perpendicular to the camera

Syntax


jsobj.SetKeepIPlaneOrthogonal(value);
value = jsobj.GetKeepIPlaneOrthogonal();


R3BOOL value = ...;
R3SetAttrs(r3obj, R3VCA_KeepIPlaneOrthogonal, value, R3TAG_END);
R3BOOL value;
R3GetAttrs(r3obj, R3VCA_KeepIPlaneOrthogonal, &value, R3TAG_END);

RelHeading

Attribute

RelHeading

Identifier

R3VCA_RelHeading

JavaScript type

Number

C type

R3FLOAT

Description

H, P and B are camera orientation angle controls in native csys

Syntax


jsobj.SetRelHeading(value);
value = jsobj.GetRelHeading();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_RelHeading, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_RelHeading, &value, R3TAG_END);

RelPitching

Attribute

RelPitching

Identifier

R3VCA_RelPitching

JavaScript type

Number

C type

R3FLOAT

Description

H, P and B are camera orientation angle controls in native csys

Syntax


jsobj.SetRelPitching(value);
value = jsobj.GetRelPitching();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_RelPitching, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_RelPitching, &value, R3TAG_END);

RelBanking

Attribute

RelBanking

Identifier

R3VCA_RelBanking

JavaScript type

Number

C type

R3FLOAT

Description

H, P and B are camera orientation angle controls in native csys

Syntax


jsobj.SetRelBanking(value);
value = jsobj.GetRelBanking();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_RelBanking, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_RelBanking, &value, R3TAG_END);

RelIPlaneHeading

Attribute

RelIPlaneHeading

Identifier

R3VCA_RelIPlaneHeading

JavaScript type

Number

C type

R3FLOAT

Description

angle controls for iplane orientation in native csys

Syntax


jsobj.SetRelIPlaneHeading(value);


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_RelIPlaneHeading, value, R3TAG_END);

RelIPlanePitching

Attribute

RelIPlanePitching

Identifier

R3VCA_RelIPlanePitching

JavaScript type

Number

C type

R3FLOAT

Description

angle controls for iplane orientation in native csys

Syntax


jsobj.SetRelIPlanePitching(value);


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_RelIPlanePitching, value, R3TAG_END);

RelIPlaneBanking

Attribute

RelIPlaneBanking

Identifier

R3VCA_RelIPlaneBanking

JavaScript type

Number

C type

R3FLOAT

Description

angle controls for iplane orientation in native csys

Syntax


jsobj.SetRelIPlaneBanking(value);


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_RelIPlaneBanking, value, R3TAG_END);

NativeCoordSys

Attribute

NativeCoordSys

Identifier

R3VCA_NativeCoordSys

Type

r3Coordsys

Description

space where rotations are computed

Syntax


jsobj.SetNativeCoordSys(value);
value = jsobj.GetNativeCoordSys();


R3COORDSYS value = ...;
R3SetAttrs(r3obj, R3VCA_NativeCoordSys, &value, R3TAG_END);
R3COORDSYS value;
R3GetAttrs(r3obj, R3VCA_NativeCoordSys, &value, R3TAG_END);

MinClipDist

Attribute

MinClipDist

Identifier

R3VCA_MinClipDist

JavaScript type

Number

C type

R3FLOAT

Description

in meters

Syntax


jsobj.SetMinClipDist(value);
value = jsobj.GetMinClipDist();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_MinClipDist, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_MinClipDist, &value, R3TAG_END);

MaxClipDist

Attribute

MaxClipDist

Identifier

R3VCA_MaxClipDist

JavaScript type

Number

C type

R3FLOAT

Description

in meters

Syntax


jsobj.SetMaxClipDist(value);
value = jsobj.GetMaxClipDist();


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3VCA_MaxClipDist, value, R3TAG_END);
R3FLOAT value;
R3GetAttrs(r3obj, R3VCA_MaxClipDist, &value, R3TAG_END);

PrivateHotp

Attribute

PrivateHotp

Identifier

R3VCA_PrivateHotp

JavaScript type

Boolean

C type

R3BOOL

Description

vcam should not follow R3VCCM_SETALLHOTPOINTS

Syntax


jsobj.SetPrivateHotp(value);
value = jsobj.GetPrivateHotp();


R3BOOL value = ...;
R3SetAttrs(r3obj, R3VCA_PrivateHotp, value, R3TAG_END);
R3BOOL value;
R3GetAttrs(r3obj, R3VCA_PrivateHotp, &value, R3TAG_END);

NoVertPersp

Attribute

NoVertPersp

Identifier

R3VCA_NoVertPersp

JavaScript type

Boolean

C type

R3BOOL

Description

keeps vertical lines parallel

Syntax


jsobj.SetNoVertPersp(value);
value = jsobj.GetNoVertPersp();


R3BOOL value = ...;
R3SetAttrs(r3obj, R3VCA_NoVertPersp, value, R3TAG_END);
R3BOOL value;
R3GetAttrs(r3obj, R3VCA_NoVertPersp, &value, R3TAG_END);

Projections

R3VC_PERSPECTIVE
R3VC_ORTHOGRAPHIC

Input method

R3VC_TOIPLANE
R3VC_TOIPLANEX
R3VC_TOIPLANEY
R3VC_TOIPLANEZ
R3VC_TOCAMERAPLANE
R3VC_TOCUSTOMPLANE
R3VC_TOAXIS
R3VC_TO3D

Viewcam Message

R3VECTOR *, base point for iplane axis locked projections

R3VECTOR *, normal for custom iplane projections

R3INT, see input method enum above

Tags

Tags

R3VCA_ClipResult2D
R3VCA_ClipResult3D