Gui::Camera Class Reference

`#include <View3DPy.h>`

## Public Types

enum  Orientation {
Top , Bottom , Front , Rear ,
Left , Right , Isometric , Dimetric ,
Trimetric
}

## Static Public Member Functions

static SbRotation rotation (Orientation view)
Formulas to get quaternion for axonometric views: More...

Enumerator
Top
Bottom
Front
Rear
Left
Right
Isometric
Dimetric
Trimetric

## ◆ rotation()

 SbRotation Camera::rotation ( Camera::Orientation view )
static

Formulas to get quaternion for axonometric views:

from math import sqrt, degrees, asin, atan
p1=App.Rotation(App.Vector(1,0,0),90)
p2=App.Rotation(App.Vector(0,0,1),alpha)
p3=App.Rotation(p2.multVec(App.Vector(1,0,0)),beta)
p4=p3.multiply(p2).multiply(p1)
from pivy import coin
c=Gui.ActiveDocument.ActiveView.getCameraNode()
c.orientation.setValue(*p4.Q)

The angles alpha and beta depend on the type of axonometry Isometric:

alpha=45
beta=degrees(asin(-sqrt(1.0/3.0)))

Dimetric:

alpha=degrees(asin(sqrt(1.0/8.0)))
beta=degrees(-asin(1.0/3.0))

Trimetric:

alpha=30.0
beta=-35.0

Verification code that the axonomtries are correct:

from pivy import coin
c=Gui.ActiveDocument.ActiveView.getCameraNode()
vo=App.Vector(c.getViewVolume().getMatrix().multVecMatrix(coin.SbVec3f(0,0,0)).getValue())
vx=App.Vector(c.getViewVolume().getMatrix().multVecMatrix(coin.SbVec3f(10,0,0)).getValue())
vy=App.Vector(c.getViewVolume().getMatrix().multVecMatrix(coin.SbVec3f(0,10,0)).getValue())
vz=App.Vector(c.getViewVolume().getMatrix().multVecMatrix(coin.SbVec3f(0,0,10)).getValue())
(vx-vo).Length
(vy-vo).Length
(vz-vo).Length
# Projection
vo.z=0
vx.z=0
vy.z=0
vz.z=0
(vx-vo).Length
(vy-vo).Length
(vz-vo).Length

References Bottom, Dimetric, Front, Isometric, Left, Rear, Right, Top, and Trimetric.

The documentation for this class was generated from the following files: