Example #1
0
PlaneControlet::PlaneControlet( const string& name,
		const Ogre::Plane& plane,
		LinearNotifyEvent func,
		const Ogre::Real s ):
	RigidControlet( name,s )
{
	mNotify = func;
	setPlane( plane );
}
Example #2
0
File: Wall.cpp Project: cslux/ledcc
void Wall::createAnimation()
{
    quint8 i = 0;

    fillCubeArray(0x00);

    if (m_direction)
        setPlane(m_axis, 0);
    else
        setPlane(m_axis, 7);

    for (i = 0; i < CUBE_SIZE ; i++)
    {
        if(m_abort)
            return;
        waitMs(speed());
        shift(m_axis, m_direction);
    }
    Q_EMIT done();
}
Example #3
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void WriteImages::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setImagePrefix( reader->readString("ImagePrefix", getImagePrefix()) );
  setFilePrefix( reader->readValue("FilePrefix", getFilePrefix()) );
  setOutputPath( reader->readString("OutputPath", getOutputPath()) );
  setColorsArrayPath( reader->readDataArrayPath("ColorsArrayPath", getColorsArrayPath()) );
  setImageFormat( reader->readValue("ImageFormat", getImageFormat()) );
  setPlane(reader->readValue("Plane", getPlane()));
  reader->closeFilterGroup();
}
Example #4
0
void BSplineCurveForm::setCurve(BSplineCurve2D_ptr curve) {
	m_curve = curve;
	m_periodicCheckBox->setCheckState( curve->isPeriodic() ? Qt::Checked : Qt::Unchecked );
	m_uniformCheckBox->setCheckState( curve->isUniform() ? Qt::Checked : Qt::Unchecked );
	m_clampedCheckBox->setCheckState( curve->isClamped() ? Qt::Checked : Qt::Unchecked );
	m_degreeSpinBox->setValue( curve->getDegree() );

	setPlane( m_guiManager.getParentPlane(m_curve) );

	m_curveInserted = true;
}
Example #5
0
void Frustum::setCamDef(Vector3 &p, Vector3 &l, Vector3 &u) {
    
	Vector3 dir,nc,fc,X,Y,Z;
    
	Z = p - l;
	Z.toNormalized();
    
	X = u * Z;
	X.toNormalized();
    
	Y = Z * X;
    
	nc = p - Z * nearD;
	fc = p - Z * farD;
    
	ntl = nc + Y * nh - X * nw;
	ntr = nc + Y * nh + X * nw;
	nbl = nc - Y * nh - X * nw;
	nbr = nc - Y * nh + X * nw;
    
	ftl = fc + Y * fh - X * fw;
	ftr = fc + Y * fh + X * fw;
	fbl = fc - Y * fh - X * fw;
	fbr = fc - Y * fh + X * fw;
    
    setPlane(ntr,ntl,ftl,0);
    setPlane(nbl,nbr,fbr,1);
    setPlane(ntl,nbl,fbl,2);
    setPlane(nbr,ntr,fbr,3);
    setPlane(ntl,ntr,nbr,4);
    setPlane(ftr,ftl,fbl,5);
}
Example #6
0
void Camera::updatePlanes() {
	mat4 &m = mViewProj;
    setPlane(planes[0], m.e30 - m.e00, m.e31 - m.e01, m.e32 - m.e02, m.e33 - m.e03); // right
    setPlane(planes[1], m.e30 + m.e00, m.e31 + m.e01, m.e32 + m.e02, m.e33 + m.e03); // left
    setPlane(planes[2], m.e30 - m.e10, m.e31 - m.e11, m.e32 - m.e12, m.e33 - m.e13); // top
    setPlane(planes[3], m.e30 + m.e10, m.e31 + m.e11, m.e32 + m.e12, m.e33 + m.e13); // bottom
    setPlane(planes[4], m.e30 - m.e20, m.e31 - m.e21, m.e32 - m.e22, m.e33 - m.e23); // near
    setPlane(planes[5], m.e30 + m.e20, m.e31 + m.e21, m.e32 + m.e22, m.e33 + m.e23); // far
}
static bool importParticleReflectionAffector(ImportContext & ctxt, const std::string & type, const DescriptionMap & d, Node * parentNode) {
	if(type != Consts::BEHAVIOUR_TYPE_PARTICLE_REFLECTION_AFFECTOR)
		return false;
	ParticleSystemNode * psn = convertToTNode<ParticleSystemNode>(parentNode);
	if(psn==nullptr)
		return false;

	auto af = new ParticleReflectionAffector(psn);

	const std::string s = d.getString(Consts::ATTR_PARTICLE_REFLECTION_PLANE, "");
	if(!s.empty()){
		std::istringstream stream(s);
		Geometry::Plane p;
		stream>>p;
		af->setPlane(p);
	}
Example #8
0
Acad::ErrorStatus
AcRectJig::acquireDefPoints()
{
    setUserInputControls((UserInputControls)
                         (AcEdJig::kAccept3dCoordinates
                          | AcEdJig::kGovernedByOrthoMode
                          | AcEdJig::kNoNegativeResponseAccepted
                          | AcEdJig::kNullResponseAccepted
                          | AcEdJig::kNoZeroResponseAccepted));

    setPlane();
    const char* prompt = "\nSpecify first corner point: ";
    setDispPrompt(prompt);

    int stat = acquirePoint(mWcsPt1);
    return (stat == AcEdJig::kNormal) ? Acad::eOk : Acad::eInvalidInput;
}
Example #9
0
void Loadbar::createAnimation()
{
    fillCubeArray(0x00);
    for (quint8 i = 0; i < CUBE_SIZE; i++)
    {
        setPlane(m_axis, i);
        if(m_abort)
            return;
        waitMs(speed());
    }
    waitMs(speed() * 2);
    for (quint8 i = 0; i < CUBE_SIZE; i++)
    {
        clearPlane(m_axis, i);
        if(m_abort)
            return;
        waitMs(speed());
    }
    Q_EMIT done();
}
Example #10
0
      void
      MinimalTIFFWriter::saveBytes(dimension_size_type plane,
                                   VariantPixelBuffer& buf,
                                   dimension_size_type x,
                                   dimension_size_type y,
                                   dimension_size_type w,
                                   dimension_size_type h)
      {
        assertId(currentId, true);

        setPlane(plane);

        dimension_size_type expectedIndex =
          tiff::ifdIndex(seriesIFDRange, getSeries(), plane);

        if (ifdIndex != expectedIndex)
          {
            boost::format fmt("IFD index mismatch: actual is %1% but %2% expected");
            fmt % ifdIndex % expectedIndex;
            throw FormatException(fmt.str());
          }

        ifd->writeImage(buf, x, y, w, h);
      }
Example #11
0
//==============================================================================
void extractClipPlanes(const Mat4& mvp, Array<Plane*, 6>& planes)
{
	// Plane equation coefficients
	Vec4 abcd;

	if(planes[Frustum::PlaneType::NEAR])
	{
		abcd = mvp.getRow(3) + mvp.getRow(2);
		setPlane(abcd, *planes[Frustum::PlaneType::NEAR]);
	}

	if(planes[Frustum::PlaneType::FAR])
	{
		abcd = mvp.getRow(3) - mvp.getRow(2);
		setPlane(abcd, *planes[Frustum::PlaneType::FAR]);
	}

	if(planes[Frustum::PlaneType::LEFT])
	{
		abcd = mvp.getRow(3) + mvp.getRow(0);
		setPlane(abcd, *planes[Frustum::PlaneType::LEFT]);
	}

	if(planes[Frustum::PlaneType::RIGHT])
	{
		abcd = mvp.getRow(3) - mvp.getRow(0);
		setPlane(abcd, *planes[Frustum::PlaneType::RIGHT]);
	}

	if(planes[Frustum::PlaneType::TOP])
	{
		abcd = mvp.getRow(3) - mvp.getRow(1);
		setPlane(abcd, *planes[Frustum::PlaneType::TOP]);
	}

	if(planes[Frustum::PlaneType::BOTTOM])
	{
		abcd = mvp.getRow(3) + mvp.getRow(1);
		setPlane(abcd, *planes[Frustum::PlaneType::BOTTOM]);
	}
}
Example #12
0
File: Plane.cpp Project: KAlO2/Pea
Plane::Plane(const vec3f& point0, const vec3f& point1, const vec3f& point2)
{
	setPlane(point0, point1, point2);
}
Example #13
0
File: Plane.cpp Project: KAlO2/Pea
Plane::Plane(const vec3f& from, const vec3f& to)
{
	setPlane(from, to);
}
static std::vector<SupportFunctionDataItem> extractSupportFunctionDataItems(
		ShadowContourDataPtr data, bool ifExtractItemsByPoints_,
		int numMaxContours)
{
	DEBUG_START;
	ASSERT(data);
	ASSERT(data->numContours > 0);

	std::vector<SupportFunctionDataItem> items;

	double factor = (double) data->numContours / (double) numMaxContours;
	int numContoursAnalyzed = 0;
	for (int iContour = 0; iContour < data->numContours; ++iContour)
	{
		if (numMaxContours != IF_ANALYZE_ALL_CONTOURS
			&& numMaxContours < data->numContours
			&& iContour != (int) floor(factor * numContoursAnalyzed))
		{
			continue;
		}
		++numContoursAnalyzed;

		SContour *contour = &data->contours[iContour];
		SupportFunctionDataItemExtractor *extractor = NULL;
		if (ifExtractItemsByPoints_)
		{
			extractor =
				static_cast<SupportFunctionDataItemExtractor*>(
				new SupportFunctionDataItemExtractorByPoints());
		}
		else
		{
			auto extractorByPlane = new
				SupportFunctionDataItemExtractorByPlane();
			extractorByPlane->setPlane(contour->plane);
			extractor =
				static_cast<SupportFunctionDataItemExtractor*>(
						extractorByPlane);
		}
		auto itemsPortion = extractSupportFunctionDataItems(contour,
				extractor);
		items.insert(items.end(), itemsPortion.begin(),
				itemsPortion.end()); /* Collect items. */
	}
	ALWAYS_PRINT(stdout, "We are analyzing only %d contours.\n",
			numContoursAnalyzed - 1);

	int iPrevZero = INT_NOT_INITIALIZED;
	int iCurr = 0;
	for (auto &item : items)
	{
		ASSERT(item.info->iContour != INT_NOT_INITIALIZED);
		ASSERT(item.info->numSidesContour != INT_NOT_INITIALIZED);
		ASSERT(item.info->iSide != INT_NOT_INITIALIZED);
		ASSERT(item.info->iNext == INT_NOT_INITIALIZED);
		if (item.info->iSide == 0)
			iPrevZero = iCurr;
		item.info->iNext =
			item.info->iSide < item.info->numSidesContour - 1
			? iCurr + 1 : iPrevZero;
		++iCurr;
	}

	/* Check the result. */
	ASSERT(checkSupportFunctionDataItemsInequality(items));

	return items;
}
Example #15
0
void BSplineCurveForm::resetPlane() {
	// TODO change scene graph for current curve/plane
	// TODO needs to be reset if current plane is deleted
	setPlane(Plane_ptr());
}
Example #16
0
 PlanarCutTransformator::PlanarCutTransformator(arma::vec normalVec, arma::vec plainOriginVec) {
     setPlane(normalVec, plainOriginVec);
 }
Example #17
0
// Sets up the scene
void initScene()
{
    // Set the number of ray bounces
    glUniform1i(glGetUniformLocation(shaderProgram, "MAX_BOUNCE"), 4);
    
    //--------------------- Lights
    // Light1
    Vec3 point(-1.0f, 1.0f, 1.0f);
    Vec3 color(1.0f, 1.0f, 1.0f);
    float intensity = 2.0f;
    setLight(shaderProgram, "uLight1", point, color, intensity);

    // Light2
    point = Vec3(1.0f, 2.0f, 0.0f);
    color = Vec3(1.0f, 1.0f, 1.0f);
    intensity = 0.5f;
    setLight(shaderProgram, "uLight2", point, color, intensity);
    
    //--------------------- Spheres
    // Sphere1
    point = Vec3(0.0f, 0.0f, 0.0f);
    //color = Vec3(0.5f, 0.0f, 0.0f);
    color = Vec3(0.0f, 0.0f, 0.0f);
    float radius = 0.3f;
    Material mat;
    mat.ka = 0.0f;
    mat.kd = 0.0f;
    //mat.ks = 1.0f;
    mat.kt = 0.9f;
    mat.color = color;
    mat.matType = 2;
    mat.ior = 1.5;
    setSphere(shaderProgram, "uSphere1", point, radius, mat);

    // Sphere2
    point = Vec3(0.6f, 0.0f, 0.0f);
    sphere2Pos = Vec4(point[0], point[1], point[2], 1.0f);
    color = Vec3(0.35f, 0.3f, 0.2f);
    radius = 0.2f;
    mat.ka = 0.1f;
    mat.kd = 0.8f;
    mat.ks = 0.2f;
    mat.color = color;
    mat.matType = 1;
    setSphere(shaderProgram, "uSphere2", point, radius, mat);
    
    // Sphere3
    point = Vec3(0.0f, 0.61f, 0.0f);
    //color = Vec3(0.5f, 0.0f, 0.0f);
    color = Vec3(0.0f, 0.0f, 0.0f);
    radius = 0.3f;
    mat.ka = 0.0f;
    mat.kd = 0.0f;
    mat.ks = 0.9f;
    mat.color = color;
    mat.matType = 1;
    setSphere(shaderProgram, "uSphere3", point, radius, mat);

    //--------------------- Planes
    // Plane1
    point = Vec3(0.0f, 0.0f, -10.0f);
    Vec3 normal(0.0f, 0.0f, 1.0f);
    color = Vec3(1.0f, 1.0f, 1.0f);
    mat.ka = 0.1f;
    mat.kd = 0.6f;
    mat.ks = 0.4f;
    mat.color = color;
    mat.matType = 0;
    bool checkered = false;
    setPlane(shaderProgram, "uPlane1", point, normal, mat, checkered);

    // Plane2 left
    point = Vec3(-4.0f, 0.0f, 0.0f);
    normal = Vec3(1.0f, 0.0f, 0.0f);
    color = Vec3(0.4f, 0.4f, 0.0f);
    mat.ka = 0.1f;
    mat.kd = 0.6f;
    mat.ks = 0.4f;
    mat.color = color;
    mat.matType = 0;
    checkered = false;            
    setPlane(shaderProgram, "uPlane2", point, normal, mat, checkered);

    // Plane3 right
    point = Vec3(4.0f, 0.0f, 0.0f);
    normal = Vec3(-1.0f, 0.0f, 0.0f);
    color = Vec3(0.0f, 0.7f, 0.0f);
    mat.ka = 0.1f;
    mat.kd = 0.6f;
    mat.ks = 0.4f;
    mat.color = color;
    mat.matType = 0;
    checkered = false;            
    setPlane(shaderProgram, "uPlane3", point, normal, mat, checkered);    
    

    // Plane4 back
    point = Vec3(0.0f, 0.0f, 10.0f);
    normal = Vec3(0.0f, 0.0f, -1.0f);
    color = Vec3(0.0f, 0.0f, 0.4f);
    mat.ka = 0.1f;
    mat.kd = 0.6f;
    mat.ks = 0.4f;
    mat.color = color;
    mat.matType = 0;
    checkered = false;            
    setPlane(shaderProgram, "uPlane4", point, normal, mat, checkered);    
    
    // Plane4 top
    point = Vec3(0.0f, 4.0f, 0.0f);
    normal = Vec3(0.0f, -1.0f, 0.0f);
    color = Vec3(0.4f, 0.0f, 0.0f);
    mat.ka = 0.1f;
    mat.kd = 0.6f;
    mat.ks = 0.4f;
    mat.color = color;
    mat.matType = 0;
    checkered = false;            
    setPlane(shaderProgram, "uPlane5", point, normal, mat, checkered);    
    
    // Plane4 bottom
    point = Vec3(0.0f, -3.0f, 0.0f);
    normal = Vec3(0.0f, 1.0f, 0.0f);
    color = Vec3(1.0f, 1.0f, 1.0f);
    mat.ka = 0.1f;
    mat.kd = 0.6f;
    mat.ks = 0.4f;
    mat.color = color;
    mat.matType = 1;
    checkered = true;            
    setPlane(shaderProgram, "uPlane6", point, normal, mat, checkered);    
}
Example #18
0
hduPlane<T>::hduPlane(const VecType &normal,
                   const VecType &pt)
{
    setPlane(normal, pt);
}