コード例 #1
0
bool ossimAlphaSensorHSI::initialize( const ossimAlphaSensorSupportData& supData )
{
   bool result = true; // Currently no error checking.

   ossimDpt imageSize = supData.getImageSize();
   setImageSize(imageSize);
   setImageRect(ossimDrect(0,0,imageSize.x-1, imageSize.y-1));
   setRefImgPt(ossimDpt(imageSize.x*.5, imageSize.y*.5));
   
   setFov(supData.getFov());
   setRollBias(supData.getRollBias());
   setPitchBias(supData.getPitchBias());
   setHeadingBias(supData.getHeadingBias());
   setSlitRot(supData.getSlitRot());
   
   setRollPoly(supData.getRollPoly());
   setPitchPoly(supData.getPitchPoly());
   setHeadingPoly(supData.getHeadingPoly());
   setLonPoly(supData.getLonPoly());
   setLatPoly(supData.getLatPoly());
   setAltPoly(supData.getAltPoly());
   setScanPoly(supData.getScanPoly());

   updateModel();

   return result;
}
コード例 #2
0
ファイル: Camera.cpp プロジェクト: ChristophPacher/Cinder
////////////////////////////////////////////////////////////////////////////////////////
// CameraOrtho
CameraOrtho::CameraOrtho()
	: Camera()
{
	lookAt( vec3( 0, 0, 0.1f ), vec3(), vec3( 0, 1, 0 ) );
	setCenterOfInterest( 0.1f );
	setFov( 35 );
}
コード例 #3
0
ファイル: ofCamera.cpp プロジェクト: 3snail/openFrameworks
//----------------------------------------
void ofCamera::setupPerspective(bool vFlip, float fov, float nearDist, float farDist, const ofVec2f & lensOffset){
	float viewW = ofGetViewportWidth();
	float viewH = ofGetViewportHeight();

	float eyeX = viewW / 2;
	float eyeY = viewH / 2;
	float halfFov = PI * fov / 360;
	float theTan = tanf(halfFov);
	float dist = eyeY / theTan;

	if(nearDist == 0) nearDist = dist / 10.0f;
	if(farDist == 0) farDist = dist * 10.0f;

	setFov(fov);
	setNearClip(nearDist);
	setFarClip(farDist);
	setLensOffset(lensOffset);
	setForceAspectRatio(false);

	setPosition(eyeX,eyeY,dist);
	lookAt(ofVec3f(eyeX,eyeY,0),ofVec3f(0,1,0));


	if(vFlip){
		setScale(1,-1,1);
	}
}
コード例 #4
0
// ---------------------------------------------------------------------------------------------------------------------------------------------------
//
bool ofxOculusRift::init( int _width, int _height, int _fboNumSamples )
{
	initFBO( _width, _height );
	
	hmdWarpShader.load("Shaders/HmdWarp");
	
	ofDisableArbTex();

		ofFbo::Settings tmpSettings = ofFbo::Settings();
		tmpSettings.width			= _width/2;
		tmpSettings.height			= _height;
		tmpSettings.internalformat	= GL_RGB;
		tmpSettings.textureTarget	= GL_TEXTURE_2D;
		tmpSettings.numSamples		= _fboNumSamples;
		
		eyeFboLeft.allocate( tmpSettings );
		eyeFboRight.allocate( tmpSettings );
	
	ofEnableArbTex();
	
	setNearClip( 0.001f );
	setFarClip( 2048.0f );
	setFov( 90.0f );

	setInterOcularDistance( -0.6f );
	setShaderScaleFactor( 1.0f );
	setDoWarping( true );

	
	return initSensor();
}
コード例 #5
0
ファイル: YarpManager.cpp プロジェクト: ChrisdAutume/MoDelVi
 YarpManager::YarpManager():
 m_acuity(0),
 m_brightness(0),
 m_fov(0),
 m_threshold(0)
 {
     std::cout<<"## YarpManager Initialisation ##"<<std::endl;
     std::cout<<"- Setting default parameters value"<<std::endl;
     setAcuity(3);
     setFov(100);
     setBrightness(50);
     setTreshold(150);
     
     std::cout<<"- Setting up YARP network"<<std::endl;
     yarp::os::Network::init();
     std::cout<<"- Opening YARP port"<<std::endl;
     std::cout<<"    * /target/module"<<std::endl;
     m_modulePort.open("/target/module");
     m_modulePort.setStrict();
     m_modulePort.useCallback(*this);
     
     std::cout<<"    * /target/parameter"<<std::endl;
     m_parameterPort.open("/target/parameter");
     m_parameterPort.setStrict();
     m_parameterPort.useCallback(*this);
 }
コード例 #6
0
void ofxGameCamera::loadCameraPosition()
{
	ofxXmlSettings loadPosition;
	if(loadPosition.loadFile(cameraPositionFile)){

		loadPosition.pushTag("camera");
		loadPosition.pushTag("position");
		// tig: defaulting with floats so as to get floats back.
		setPosition(ofVec3f(loadPosition.getValue("X", 0.),
							loadPosition.getValue("Y", 0.),
							loadPosition.getValue("Z", 0.)));
		targetNode.setPosition(getPosition());
		
		loadPosition.popTag();

		loadPosition.pushTag("rotation");
		targetXRot = rotationX = loadPosition.getValue("X", 0.);
		targetYRot = rotationY = loadPosition.getValue("Y", 0.);
		targetZRot = rotationZ = loadPosition.getValue("Z", 0.);
		float fov = loadPosition.getValue("FOV", -1);
		if(fov != -1){
			setFov(fov);
		}
		
		loadPosition.popTag();

		loadPosition.popTag(); //pop camera;

		updateRotation();
	}
	else{
		ofLog(OF_LOG_ERROR, "ofxGameCamera: couldn't load position!");
	}

}
コード例 #7
0
ファイル: Camera.cpp プロジェクト: AKS2346/Cinder
////////////////////////////////////////////////////////////////////////////////////////
// CameraOrtho
CameraOrtho::CameraOrtho()
	: Camera()
{
	lookAt( Vec3f( 0.0f, 0.0f, 0.1f ), Vec3f::zero(), Vec3f::yAxis() );
	setCenterOfInterest( 0.1f );
	setFov( 35.0f );
}
コード例 #8
0
void CloudsRGBDCamera::setPositionFromMouse() {

    float percentOnCurve = ofMap(GetCloudsInputX(), canvasWidth*.2, canvasWidth*.8, 0, 1, true);
    ofVec3f sidePositionLeft  = lookTarget + ofVec3f(-sideDistance,0,sidePullback);
    ofVec3f sidePositionRight = lookTarget + ofVec3f( sideDistance,0,sidePullback);
    ofVec3f frontPosition = lookTarget + ofVec3f(0,0,-frontDistance);
    ofVec3f position;
    if(percentOnCurve > .5) {
        position = frontPosition.getInterpolated(sidePositionRight, ofMap(percentOnCurve, .5, 1.0, 0, 1.0) );
    }
    else {
        position = sidePositionLeft.getInterpolated(frontPosition, ofMap(percentOnCurve, 0, .5, 0, 1.0) );
    }

    float liftDrift = ofMap(GetCloudsInputY(), canvasHeight*.2, canvasHeight*.8, -liftRange,liftRange, true);
    position.y += ofMap(abs(.5 - percentOnCurve), 0, .5, (liftDrift + liftAmount), (liftDrift-liftAmount)*.5);
    position.z -= MAX(liftDrift,0) * .5; // zoom in on mouse up

    targetPosition = position;
    currentPosition += (targetPosition - currentPosition) * damp;

    currentLookTarget = lookTarget - ofVec3f(0,dropAmount,-sidePullback);

    //calculate drift;
    //ofVec3f driftOffset(0,0,0);
    ofVec3f driftPosition = currentPosition;
    float channelA = 1000;
    float channelB = 1500;
    if(maxDriftAngle > 0) {
        ofVec3f toCamera = currentPosition - currentLookTarget;
        ofQuaternion driftQuatX,driftQuatY;

        driftNoisePosition += driftNoiseSpeed;// * (ofGetElapsedTimef() - ofGetLastFrameTime());
        float driftX = ofSignedNoise( channelA, driftNoisePosition );
        float driftY = ofSignedNoise( channelB, driftNoisePosition );

        driftPosition.rotate(driftX*maxDriftAngle, currentLookTarget, ofVec3f(0,1,0));
        driftPosition.rotate(driftY*maxDriftAngle, currentLookTarget, ofVec3f(1,0,0));

//		driftQuatX.makeRotate(maxDriftAngle*driftX, 0, 1, 0);
//		driftQuatY.makeRotate(maxDriftAngle*driftY, 1, 0, 0);
//		driftOffset = driftQuatX * driftQuatY * (ofVec3f(0,0,1) * toCamera.length());
    }

    mouseBasedNode.setPosition(driftPosition);
    mouseBasedNode.lookAt(currentLookTarget);

    //Compute new FOV
    bool onEdge = GetCloudsInputX() < 20 || GetCloudsInputX() > canvasWidth - 40 ||
                  GetCloudsInputY() < 20 || GetCloudsInputY() > canvasHeight - 40;
    float newFov;
    if(onEdge) {
        newFov = getFov() + ( zoomFOVRange.max - getFov() ) * .05;
    }
    else {
        newFov = getFov() + (zoomFOVRange.min - getFov() ) * .005;
    }
    setFov(newFov);

}
コード例 #9
0
void StelMovementMgr::setMaxFov(double max)
{
	maxFov = max;
	if (currentFov > max)
	{
		setFov(max);
	}
}
コード例 #10
0
ファイル: Camera.cpp プロジェクト: Jon0/CompositeLighting
void Camera::resize(int x, int y) {
	windowwidth = x;
	windowheight = y;
	cam_aspect = (double) x / (double) y;
	arcball_x = (x / 2.0);
	arcball_y = (y / 2.0);
	arcball_radius = (x / 2.0);
	setFov(vfov);
}
コード例 #11
0
MazeCamera2::MazeCamera2(float x, float y, float z) : ofCamera()
{
    setPosition(x, y, z);
    lookAt(ofVec3f(x, y, z+10));
    rotate(ParamManager2::getInstance().cameraAngle, ofVec3f(1, 0, 0));
    setFov(100);
    
    vel = ofVec3f(0, 0, 1);
}
コード例 #12
0
ファイル: YarpManager.cpp プロジェクト: ChrisdAutume/MoDelVi
 void YarpManager::onRead(yarp::os::Bottle& b) {     
     std::string name = b.get(0).asString().c_str();
     int value = b.get(1).asInt();
     
     if(name == "acuity") setAcuity(value);
     else if(name == "fov") setFov(value);
     else if(name == "brightness") setBrightness(value);
     else if(name == "threshold") setTreshold(value);
     else std::cout<<"Bottle message incorrect"<<std::endl;
 }
コード例 #13
0
ファイル: types.cpp プロジェクト: AnnaMariaM/opencv
cv::viz::Camera::Camera(const Vec2f &fov, const Size &window_size)
{
    CV_Assert(window_size.width > 0 && window_size.height > 0);
    setClip(Vec2d(0.01, 1000.01)); // Default clipping
    setFov(fov);
    window_size_ = window_size;
    // Principal point at the center
    principal_point_ = Vec2f(static_cast<float>(window_size.width)*0.5f, static_cast<float>(window_size.height)*0.5f);
    focal_ = Vec2f(principal_point_[0] / tan(fov_[0]*0.5f), principal_point_[1] / tan(fov_[1]*0.5f));
}
コード例 #14
0
CameraNode::CameraNode()
	: width(1280), height(720), near(0.01f), far(100.0f), fovy(29.8f)
{
	setNearClip(near);
	setFarClip(far);
	setFov(fovy);
	setScale(0.5f);
	
	vidGrabber.setDeviceID(1);
	vidGrabber.initGrabber(width, height);
}
コード例 #15
0
void SecondCamera::setFromOtherCamera(ofCamera& other)
{
	setFarClip(other.getFarClip());
	setNearClip(other.getNearClip());
	setFov(other.getFov());
	
	matProjection = other.getProjectionMatrix();
	matModelView = other.getModelViewMatrix();
	
	matModelView.postMultTranslate(-_offset);
	
	isActive = true;
}
コード例 #16
0
ファイル: Camera.cpp プロジェクト: christiansjostedt/CRay
Camera::Camera(vec3 position,vec3 center,vec3 upVector,int ImgSizeX, int ImgSizeY, float FOV)
{
	//setFov(ImgSizeX, ImgSizeY);
	up = upVector;
	cent = center;
	pos = position;
	imgResX = ImgSizeX;
	imgResY = ImgSizeY;
	fov = FOV;

	setAspect(ImgSizeX,ImgSizeY);
	setFov(fov);
	recalc();

}
コード例 #17
0
void PerspectiveCamera::load(const QString &filename)
{
        FILE *fp=fopen(filename.toStdString().c_str(),"rb");

	float sfov=0;

	float sfarPlane=0;
	float snearPlane=0;

	GGL::Point3f sfrom;
	GGL::Point3f sto;
	GGL::Point3f sup;


	fread(&sfov,sizeof(float),1,fp);
        qDebug("fov:%f",sfov);
	fread(&sfarPlane,sizeof(float),1,fp);
        qDebug("far plane:%f",sfarPlane);
	fread(&snearPlane,sizeof(float),1,fp);
        qDebug("near plane:%f",snearPlane);
	float vsfrom[3];

	fread(vsfrom,sizeof(float),3,fp);
        qDebug("from:%f,%f,%f",vsfrom[0],vsfrom[1],vsfrom[2]);

	float vsto[3];

	fread(vsto,sizeof(float),3,fp);
        qDebug("to:%f,%f,%f",vsto[0],vsto[1],vsto[2]);
	float vsup[3];
	fread(vsup,sizeof(float),3,fp);

        qDebug("up:%f,%f,%f",vsup[0],vsup[1],vsup[2]);

	fclose(fp);


	setFov(sfov);
	setFarPlane(sfarPlane);
	setNearPlane(snearPlane);
	setFrom(GGL::Point3f(vsfrom[0],vsfrom[1],vsfrom[2]));
	setTo(GGL::Point3f(vsto[0],vsto[1],vsto[2]));
	setUp(GGL::Point3f(vsup[0],vsup[1],vsup[2]));
}
コード例 #18
0
//----------------------------------------
void ofCamera::setupPerspective(bool _vFlip, float fov, float nearDist, float farDist, const ofVec2f & lensOffset){
	ofRectangle orientedViewport = ofGetNativeViewport();
	float eyeX = orientedViewport.width / 2;
	float eyeY = orientedViewport.height / 2;
	float halfFov = PI * fov / 360;
	float theTan = tanf(halfFov);
	float dist = eyeY / theTan;

	if(nearDist == 0) nearDist = dist / 10.0f;
	if(farDist == 0) farDist = dist * 10.0f;

	setFov(fov);
	setNearClip(nearDist);
	setFarClip(farDist);
	setLensOffset(lensOffset);
	setForceAspectRatio(false);

	setPosition(eyeX,eyeY,dist);
	lookAt(ofVec3f(eyeX,eyeY,0),ofVec3f(0,1,0));
	vFlip = _vFlip;
}
コード例 #19
0
//----------------------------------------
void ofCamera::setupOffAxisViewPortal(const ofVec3f & topLeft, const ofVec3f & bottomLeft, const ofVec3f & bottomRight){
	ofVec3f bottomEdge = bottomRight - bottomLeft; // plane x axis
	ofVec3f leftEdge = topLeft - bottomLeft; // plane y axis
	ofVec3f bottomEdgeNorm = bottomEdge.getNormalized();
	ofVec3f leftEdgeNorm = leftEdge.getNormalized();
	ofVec3f bottomLeftToCam = this->getPosition() - bottomLeft;
	
	ofVec3f cameraLookVector = leftEdgeNorm.getCrossed(bottomEdgeNorm);
	
	ofVec3f cameraUpVector = bottomEdgeNorm.getCrossed(cameraLookVector);
	
	lookAt(cameraLookVector + this->getPosition(), cameraUpVector);

	//lensoffset
	ofVec2f lensOffset;
	lensOffset.x = -bottomLeftToCam.dot(bottomEdgeNorm) * 2.0f / bottomEdge.length() + 1.0f;
	lensOffset.y = -bottomLeftToCam.dot(leftEdgeNorm) * 2.0f / leftEdge.length() + 1.0f;
	setLensOffset(lensOffset);
	setAspectRatio( bottomEdge.length() / leftEdge.length() );
	float distanceAlongOpticalAxis = abs(bottomLeftToCam.dot(cameraLookVector));
	setFov(2.0f * RAD_TO_DEG * atan( (leftEdge.length() / 2.0f) / distanceAlongOpticalAxis));
}
コード例 #20
0
ファイル: SwCamera.cpp プロジェクト: xubingyue/XIRE
SwCamera::SwCamera(void *parentWindow, const core::Vectorf3 &pos,
	/*const core::Vectorf3 &lookat,*/
	const core::Quaternion &rot,
	const core::Vectorf3 &updir,
	F32 znear,
	F32 zfar,
	F32 fov)  
{	 
	Parent = parentWindow;

	setPosition(pos);
	setFov(fov);
	
	up = updir;

	quat = rot;

	zNear = znear;
	zFar = zfar;
 
	MarkDirty();

	Update();
}
コード例 #21
0
ファイル: Tuning.cpp プロジェクト: flair2005/omnidome
      void Tuning::setup()
      {
        layout_ = new TuningLayout(this);
        setLayout(layout_);

        setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);

        /// Setup title bar
        titleBar_ = new TitleBar("Projector",this);
        titleBar_->installEventFilter(this);
        connect(titleBar_,SIGNAL(closeButtonClicked()),this,SLOT(prepareRemove()));
        layout_->addWidget(titleBar_,TuningLayout::Role::TITLE);

        /// Setup preview window
        glView_ = new TuningGLView(this);
        QSizePolicy _sizePolicy(QSizePolicy::Ignored,QSizePolicy::Expanding);
        glView_->setSizePolicy(_sizePolicy);
        glView_->setKeepAspectRatio(true);
        glView_->setBorder(0.0);
        glView_->setViewOnly(true);
        glView_->installEventFilter(this);
        layout_->addWidget(glView_,TuningLayout::Role::PREVIEW);

        fullscreen_.reset(new TuningGLView());
        fullscreen_->setViewOnly(true);
        fullscreen_->setShowCursor(true);
        fullscreen_->hide();

        /// FOV view slider
        /// @todo Connect this with threshold slider
        auto* _fov =  addWidget("FOV",60.0,10.0,160.0);
        _fov->setSingleStep(4.0);
        _fov->setPageStep(45.0);
        _fov->setSuffix("°");
        connect(_fov,SIGNAL(valueChanged()),this,SLOT(setFov()));

        /// Throw ratio slider
        /// @todo Connect this with FOV slider
        auto* _throwRatio = addWidget("Throw Ratio",1.0,0.1,5.0);
        _throwRatio->setSingleStep(0.1);
        _throwRatio->setPageStep(0.3);
        connect(_throwRatio,SIGNAL(valueChanged()),this,SLOT(setThrowRatio()));

        /// Yaw angle slider (all projector setups)
        auto&& _yaw = addAngleWidget("Yaw",0.0,0.0,360.0);

        /// Tower height slider (PeripheralSetup only)
        auto&& _towerHeight = addOffsetWidget("Tower Height",2.0,-5.0,10.0);
        _towerHeight->setSingleStep(0.1);
        _towerHeight->setPageStep(1.0);
        _towerHeight->setPivot(0.0);

        /// Distance slider (PeripheralSetup only)
        auto&& _distance = addOffsetWidget("Distance",5.0,0.0,10.0);
        _distance->setPageStep(1.0);

        /// Shift offset slider (PeripheralSetup only)
        auto&& _shift = addOffsetWidget("Shift",0.0,-2.0,2.0);
        _shift->setPageStep(1.0);
        _shift->setPivot(0.0);

        /// X offset slider (FreeSetup only)
        auto&& _x = addOffsetWidget("X",0.0,-10.0,10.0);
        _x->setPageStep(1.0);
        _x->setPivot(0.0);

        /// Y offset slider (FreeSetup only)
        auto&& _y = addOffsetWidget("Y",0.0,-10.0,10.0);
        _y->setPageStep(1.0);
        _y->setPivot(0.0);

        /// Z offset slider (FreeSetup only)
        auto&& _z = addOffsetWidget("Z",0.0,-10.0,10.0);
        _z->setPageStep(1.0);
        _z->setPivot(0.0);

        /// Pitch angle slider (both setups)
        auto&& _pitch = addAngleWidget("Pitch",30.0,-90.0,90.0);
        _pitch->setPivot(0.0);

        /// Roll angle slider (both setups)
        auto&& _roll = addAngleWidget("Roll",0.0,-45.0,45.0);
        _roll->setSingleStep(1.0);
        _roll->setPageStep(5.0);
        _roll->setPivot(0.0);

        /// Delta yaw angle slider (PeripheralSetup only)
        auto&& _deltaYaw = addAngleWidget("Delta Yaw",0.0,-45.0,45.0);
        _deltaYaw->setSingleStep(1.0);
        _deltaYaw->setPageStep(5.0);
        _deltaYaw->setPivot(0.0);

        widgetgroup_type _titleAndPreview(
        {
          { titleBar_, TuningLayout::Role::TITLE } ,
          { glView_, TuningLayout::Role::PREVIEW }
        });

        auto addParameters = [&](widgetgroup_type const& _group, std::vector<QWidget*> const& _widgets) -> widgetgroup_type
        {
          widgetgroup_type _result = _group;
          for (auto& _widget : _widgets)
            _result.emplace_back(_widget,TuningLayout::Role::PARAMETER);
          return _result;
        };

        addGroup("Minimized", { { titleBar_, TuningLayout::Role::TITLE } });

        /// Make slider groups
        addGroup("PreviewOnly",_titleAndPreview);
        addGroup("FOVSliders",addParameters(_titleAndPreview, { _fov, _throwRatio }));
        addGroup("FreeSetup",addParameters( _titleAndPreview, {_yaw, _pitch, _roll, _x, _y, _z }));
        addGroup("PeripheralSetup",
                 addParameters( _titleAndPreview,
        { _yaw, _pitch, _distance, _towerHeight, _shift, _deltaYaw, _roll }));

        /// Setup/update mode
        sessionModeChange();
      }
コード例 #22
0
ファイル: Tuning.cpp プロジェクト: cr8tr/omnidome
      void Tuning::setup()
      {
        this->setFocusPolicy(Qt::TabFocus);
        this->installEventFilter(this->parent());
        layout_ = new TuningLayout(this);
        setLayout(layout_);

        setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

        /// Setup title bar
        titleBar_.reset(new TitleBar("Projector", this));
        connect(titleBar_.get(), SIGNAL(
                  closeButtonClicked()),              this,
                SLOT(prepareRemove()));
        connect(titleBar_.get(), SIGNAL(colorChanged(
                                          QColor const &)), this,
                SLOT(updateParameters()));
        connect(titleBar_.get(), SIGNAL(
                  freeSetupSelected()),               this,
                SLOT(
                  resetToFreeSetup()));
        connect(titleBar_.get(), SIGNAL(
                  peripheralSetupSelected()),         this,
                SLOT(resetToPeripheralSetup()));
        layout_->addWidget(titleBar_.get(), TuningLayout::Role::TITLE);

        /// Setup preview window
        glView_.reset(new TuningGLView(this));
        QSizePolicy _sizePolicy(QSizePolicy::Ignored,
                                QSizePolicy::Expanding);
        glView_->setSizePolicy(_sizePolicy);
        glView_->setKeepAspectRatio(true);
        glView_->setBorder(0.0);
        glView_->setViewOnly(true);
        glView_->setUpdateFrequency(10.0); // 10.0 fps
        glView_->installEventFilter(this);

        connect(glView_.get(), SIGNAL(dataModelChanged()), this,
                SIGNAL(dataModelChanged()));

        layout_->addWidget(glView_.get(), TuningLayout::Role::PREVIEW);

        /// FOV view slider
        /// @todo Connect this with threshold slider
        auto *_fov =  addWidget("FOV", 60.0, 10.0, 160.0);
        _fov->setSingleStep(1.0);
        _fov->setPageStep(5.0);
        _fov->setSuffix("°");
        connect(_fov, SIGNAL(valueChanged()), this, SLOT(setFov()));

        auto *_keystone = addWidget("Keystone", 0.0, -1.0, 2.0);
        _keystone->setSingleStep(0.01);
        _keystone->setPageStep(0.1);
        connect(_keystone, SIGNAL(valueChanged()), this,
                SLOT(setKeyStone()));

        /// Throw ratio slider
        /// @todo Connect this with FOV slider
        auto *_throwRatio = addWidget("Throw Ratio", 1.0, 0.2, 5.0);
        _throwRatio->setSingleStep(0.01);
        _throwRatio->setPageStep(0.05);

        //    _throwRatio->setScale(RangedFloat::Scale::RECIPROCAL);
        connect(_throwRatio, SIGNAL(valueChanged()), this,
                SLOT(setThrowRatio()));

        /// Yaw angle slider (all projector setups)
        auto && _yaw = addAngleWidget("Yaw", 0.0, 0.0, 360.0);
        _yaw->setSingleStep(0.1);
        _yaw->setPageStep(1.0);

        /// Tower height slider (PeripheralSetup only)
        auto && _towerHeight = addOffsetWidget("Tower Height",
                                               0.2,
                                               -0.5,
                                               1.0);

        /// Distance slider (PeripheralSetup only)
        auto && _distance = addOffsetWidget("Distance", 0.4, 0.0, 1.0);

        /// Shift offset slider (PeripheralSetup only)
        auto && _shift = addOffsetWidget("Shift", 0.0, -0.2, 0.2);

        /// X offset slider (FreeSetup only)
        auto && _x = addOffsetWidget("X", 0.0, -1.0, 1.0);

        /// Y offset slider (FreeSetup only)
        auto && _y = addOffsetWidget("Y", 0.0, -1.0, 1.0);

        /// Z offset slider (FreeSetup only)
        auto && _z = addOffsetWidget("Z", 0.0, -1.0, 1.0);

        /// Pitch angle slider (both setups)
        auto && _pitch = addAngleWidget("Pitch", 30.0, -180.0, 180.0);
        _pitch->setSingleStep(0.1);
        _pitch->setPageStep(1.0);
        _pitch->setPivot(0.0);

        /// Roll angle slider (both setups)
        auto && _roll = addAngleWidget("Roll", 0.0, -180.0, 180.0);
        _roll->setSingleStep(0.1);
        _roll->setPageStep(1.0);
        _roll->setPivot(0.0);

        /// Delta yaw angle slider (PeripheralSetup only)
        auto && _deltaYaw = addAngleWidget("Delta Yaw", 0.0, -45.0, 45.0);
        _deltaYaw->setSingleStep(0.1);
        _deltaYaw->setPageStep(1.0);
        _deltaYaw->setPivot(0.0);

        widgetgroup_type _titleAndPreview(
        {
          { titleBar_.get(), TuningLayout::Role::TITLE },
          { glView_.get(), TuningLayout::Role::PREVIEW }
        });

        auto addParameters =
          [&](widgetgroup_type const& _group,
              std::vector<QWidget *>const& _widgets) -> widgetgroup_type
          {
            widgetgroup_type _result = _group;

            for (auto& _widget :
                 _widgets) _result.emplace_back(_widget,
                                                TuningLayout::Role::PARAMETER);


            return _result;
          };

        addGroup("Minimized",
                 { { titleBar_.get(),
                     TuningLayout::Role::TITLE } });

        /// Make slider groups
        addGroup("PreviewOnly", _titleAndPreview);
        addGroup("FOVSliders",
                 addParameters(_titleAndPreview,
                               { _fov, _throwRatio, _keystone }));
        addGroup("FreeSetup",
                 addParameters(_titleAndPreview,
                               { _yaw, _pitch, _roll, _x, _y, _z, _fov,
                                 _throwRatio, _keystone }));
        addGroup("PeripheralSetup",
                 addParameters(_titleAndPreview,
                               { _yaw, _pitch, _distance, _towerHeight,
                                 _shift, _deltaYaw, _roll, _fov,
                                 _throwRatio, _keystone }));

        /// Setup/update mode
        sessionModeChange();

        for (int i = 0; i < layout_->count(); ++i) {
          auto _widget = layout_->itemAt(i)->widget();

          if (!_widget) continue;
          _widget->installEventFilter(this);
          _widget->installEventFilter(this->parent());
        }
      }
コード例 #23
0
ファイル: ccCalibratedImage.cpp プロジェクト: jebd/trunk
void ccCalibratedImage::setFovFromFocal(float focal_pix)
{
	setFov(CC_RAD_TO_DEG * 2.0 * atan((float)m_height * 0.5f / m_focal_pix));
}
コード例 #24
0
 void setCFov (double f) {
     setFov(f);
 }
コード例 #25
0
ファイル: ccCalibratedImage.cpp プロジェクト: eile/trunk
void ccCalibratedImage::setFovFromFocal(float focal_pix)
{
	setFov(static_cast<float>(CC_RAD_TO_DEG*2.0) * atan(static_cast<float>(m_height) / (m_focal_pix*2.0f)));
}
コード例 #26
0
// Update autoZoom if activated
void StelMovementMgr::updateAutoZoom(double deltaTime)
{
	if (flagAutoZoom)
	{
		// Use a smooth function
		double c;

		if( zoomMove.startFov > zoomMove.aimFov )
		{
			// slow down as we approach final view
			c = 1 - (1-zoomMove.coef)*(1-zoomMove.coef)*(1-zoomMove.coef);
		}
		else
		{
			// speed up as we leave zoom target
			c = (zoomMove.coef)*(zoomMove.coef)*(zoomMove.coef);
		}

		double newFov=zoomMove.startFov + (zoomMove.aimFov - zoomMove.startFov) * c;

		zoomMove.coef+=zoomMove.speed*deltaTime*1000;
		if (zoomMove.coef>=1.)
		{
			flagAutoZoom = 0;
			newFov=zoomMove.aimFov;
		}

		setFov(newFov); // updates currentFov->don't use newFov later!

		// In case we have offset center, we want object still visible in center.
		if (flagTracking && objectMgr->getWasSelected()) // vision vector locked on selected object
		{
			Vec3d v, vUp;
			switch (mountMode)
			{
				case MountAltAzimuthal:
					v = objectMgr->getSelectedObject()[0]->getAltAzPosAuto(core);
					break;
				case MountEquinoxEquatorial:
					v = objectMgr->getSelectedObject()[0]->getEquinoxEquatorialPos(core);
					break;
				case MountGalactic:
					v = objectMgr->getSelectedObject()[0]->getGalacticPos(core);
					break;
				default:
					qWarning() << "StelMovementMgr: unexpected mountMode" << mountMode;
					Q_ASSERT(0);
			}

			double lat, lon; // general: longitudinal, latitudinal
			StelUtils::rectToSphe(&lon, &lat, v); // guaranteed to be normalized.
			// vUp could usually be (0/0/1) in most cases, unless |lat|==pi/2. We MUST build an adequate Up vector!
			if (fabs(lat)>0.9*M_PI/2.0)
			{
				vUp = Vec3d(-cos(lon), -sin(lon), 0.) * (lat>0. ? 1. : -1. );
			}
			else
				vUp.set(0.,0.,1.);
			float latOffset=core->getCurrentStelProjectorParams().viewportCenterOffset[1]*currentFov*M_PI/180.0f;
			lat+=latOffset;
			StelUtils::spheToRect(lon, lat, v);

			if (flagAutoMove)
			{
				move.aim=mountFrameToJ2000(v);
				move.aim.normalize();
				move.aim*=2.;
				move.aimUp=mountFrameToJ2000(vUp);
				move.aimUp.normalize();
			}
			else
			{
				setViewDirectionJ2000(mountFrameToJ2000(v));
				setViewUpVectorJ2000(mountFrameToJ2000(vUp));
			}
		}
	}
}
コード例 #27
0
void StelMovementMgr::changeFov(double deltaFov)
{
	// if we are zooming in or out
	if (deltaFov)
		setFov(currentFov + deltaFov);
}