示例#1
0
文件: avl.c 项目: shijith/toy
void tra(struct node *t)
{
				if(t) {
								printf("%d \n", t -> data);
								tra(t -> left);
								tra(t -> right);
				}
}
示例#2
0
void init() {
    hd = sin(pi/3) * l;
    wd = l + l / 2;
    xan = xa / wd;
    yan = ya / hd;
    xbn = xb / wd;
    ybn = yb / hd;
    tra(xan, yan, xa, ya); tra(xbn, ybn, xb, yb);
}
示例#3
0
文件: 128.cpp 项目: Shenjiaqi/sgu
long long solv()
{
    if(n&1)
        return 0;
    qsort(p,n,sizeof(p[0]),cmp1);
    long long ans=0;
    for(int i=0;i<n;)
    {
        if(p[i][0]!=p[i+1][0])
            return 0;
        add(p[i][2],p[i+1][2],0);
        ans+=(long long)(p[i+1][1]-p[i][1]);
        l[poi][0]=p[i][1],l[poi][1]=p[i+1][1],l[poi][2]=p[i][0],++poi;
        i+=2;
    }
    qsort(p,n,sizeof(p[0]),cmp2);
    for(int i=0;i<n;)
    {
        if(p[i][1]!=p[i+1][1])
            return 0;
        add(p[i][2],p[i+1][2],1);
        ans+=(long long)(p[i+1][0]-p[i][0]);
        if(check(p[i][0],p[i+1][0],p[i][1]))
            return 0;
        i+=2;
    }
    if(tra()<n)
        return 0;
    return ans;
}
示例#4
0
Joint::Joint(btQuaternion quat, btVector3 tr, btVector3* pts, int num, float rad){
  btTransform tra(quat, tr);
  trans = tra;
  points = pts;
  radius = rad;
  numPoints = num;
}
示例#5
0
 UndirectedGraphNode *cloneGraph(UndirectedGraphNode *node) {
     if(!node){
         return NULL;
     }
     tra(node);
     clone(node);
     return static_cast<UndirectedGraphNode*>(buf[node]);
     
 }
示例#6
0
 void tra(UndirectedGraphNode *node){
     if(buf.find(node)!=buf.end()){
         return;
     }
     buf[node] = new UndirectedGraphNode(node->label);
     for(auto item:node->neighbors){
         tra(item);
     }
 }
示例#7
0
glm::mat4			neb::phx::util::convert(physx::PxTransform const & t)
{
	glm::quat q(convert(t.q));
	glm::vec3 p(convert(t.p));
	//mat4 ret(p,q);

	glm::mat4 rot(glm::mat4_cast(q));
	glm::mat4 tra(glm::translate(p));

	return rot * tra;
}
示例#8
0
void StaticPoseNode::publishTf(const ros::Time &tstamp)
{
    for (unsigned int i = 0; i < transforms_.size(); i++) {
        pose_msgs::Transform &t = transforms_[i];
        V4R::PoseD pose(&t.rotation.x, &t.translation.x);
        cv::Mat_<double> q = pose.quaterion();
        tf::Quaternion rot(q(0),q(1), q(2), q(3));
        tf::Vector3 tra(pose.x(), pose.y(), pose.z());
        tf::StampedTransform st( tf::Transform(rot, tra), tstamp, t.frameSrc, t.frameDes);
        transformBroadcaster_.sendTransform (st );
    }
}
QgsPoint3DSymbol QgsPoint3DSymbolWidget::symbol() const
{
  QVariantMap vm;
  switch ( cboShape->currentIndex() )
  {
    case 0:  // sphere
      vm[QStringLiteral( "radius" )] = spinRadius->value();
      break;
    case 1:  // cylinder
      vm[QStringLiteral( "radius" )] = spinRadius->value();
      vm[QStringLiteral( "length" )] = spinLength->value();
      break;
    case 2:  // cube
      vm[QStringLiteral( "size" )] = spinSize->value();
      break;
    case 3:  // cone
      vm[QStringLiteral( "topRadius" )] = spinTopRadius->value();
      vm[QStringLiteral( "bottomRadius" )] = spinBottomRadius->value();
      vm[QStringLiteral( "length" )] = spinLength->value();
      break;
    case 4:  // plane
      vm[QStringLiteral( "size" )] = spinSize->value();
      break;
    case 5:  // torus
      vm[QStringLiteral( "radius" )] = spinRadius->value();
      vm[QStringLiteral( "minorRadius" )] = spinMinorRadius->value();
      break;
    case 6:  // model
      vm[QStringLiteral( "model" )] = lineEditModel->text();
      vm[QStringLiteral( "overwriteMaterial" )] = cbOverwriteMaterial->isChecked();
      break;
  }

  QQuaternion rot( QQuaternion::fromEulerAngles( spinRX->value(), spinRY->value(), spinRZ->value() ) );
  QVector3D sca( spinSX->value(), spinSY->value(), spinSZ->value() );
  QVector3D tra( spinTX->value(), spinTY->value(), spinTZ->value() );

  QMatrix4x4 tr;
  tr.translate( tra );
  tr.scale( sca );
  tr.rotate( rot );

  QgsPoint3DSymbol sym;
  sym.setAltitudeClamping( static_cast<Qgs3DTypes::AltitudeClamping>( cboAltClamping->currentIndex() ) );
  sym.setShape( static_cast<QgsPoint3DSymbol::Shape>( cboShape->itemData( cboShape->currentIndex() ).toInt() ) );
  sym.setShapeProperties( vm );
  sym.setMaterial( widgetMaterial->material() );
  sym.setTransform( tr );
  return sym;
}
示例#10
0
TranslationRotation3D TranslationRotation3D::inverseTransform() const {

  Eigen::Map<const Eigen::Vector3d> tra(T_);
  Eigen::Map<const Eigen::Matrix<double, 3, 3, Eigen::RowMajor> > rot(R_mat_);

  double rot_inv_ptr[9];
  Eigen::Map<Eigen::Matrix<double, 3, 3, Eigen::RowMajor> > rot_inv(
      rot_inv_ptr);

  rot_inv = rot.transpose();
  double tra_inv_ptr[3];
  Eigen::Map<Eigen::Vector3d> tra_inv(tra_inv_ptr);
  tra_inv = -rot_inv * tra;

  TranslationRotation3D pose_inv;
  pose_inv.setT(tra_inv_ptr);
  pose_inv.setR_mat(rot_inv_ptr);
  pose_inv.setValid(valid_);

  return (pose_inv);
}
DetectFishDeth::DetectFishDeth(const vector<vector<Point> > &contours, int bp, int _avg_area, int _num_fish)
{
    num_fish = _num_fish;

    border_position = bp;
    avg_area = _avg_area;

    for (int i = 0; i < num_fish; ++i)
    {
        vector <Point> tra(SIZE_FRAME, { 0, 0 });

        trajectory.push_back(tra);

        Moments m = moments(contours[i]);

        center_point.push_back(Point(m.m10 / m.m00, m.m01 / m.m00));//计算鱼的中心点

        contour_area.push_back(contourArea(contours[i]));//调用外部函数求轮廓面积

        fish_Assigned.push_back(0);

        nearest_point.push_back(0);
    }
}
	tresult PLUGIN_API TripleFProcessor::initialize(FUnknown *context)
	{
		tresult initbase = AudioEffect::initialize(context);

		if(initbase == kResultTrue)
		{
			if(removeAllBusses() != kResultTrue)
				return kResultFalse;

            addAudioInput (USTRING("Stereo In"), SpeakerArr::kStereo);
            addAudioOutput (USTRING("Stereo out"), SpeakerArr::kStereo);

            try
            {
                m_env = new OpenCLEnvironment(CL_DEVICE_TYPE_GPU);
                m_compiler = new Compiler(*m_env, path("%FFF%/cl").getPath());
                m_compiler->build();

                WaveReader<Sample> hReader("h.wav");

                UInt channelCount = hReader.getChannelCount();
                UInt sampleCount = hReader.getSampleCount();

                m_ssize = sampleCount - 1;


                ComputingData<Sample> cd(sampleCount);
                DeviceProperties devprops(m_env->getDevice());
                Mapper map(cd, devprops, 0);

                m_x = new mcf::hmcp;
                m_y = new mcf::hmcp;

                mcf::multichannel b, a;
                
                mcf::create(b, *m_env, CL_MEM_READ_ONLY, channelCount, fff_POW2(map.getLb2N()));

                mcf::create(a, *m_env, CL_MEM_READ_ONLY, channelCount, fff_POW2(map.getLb2N()));

                for(UInt ch = 0; ch < channelCount; ++ch)
                    a.host->getRawReal(ch)[0] = (Sample)20.f;


                mcf::create(m_H, *m_env, CL_MEM_READ_WRITE, channelCount, fff_POW2(map.getLb2N()));

                hReader.readFile(*(b.host));


                TransferFunction<Sample> tra(*m_compiler, *b, *a, *m_H);
                tra.invokeAndWait();
            }
            catch(...)
            {
                initbase = kResultFalse;
            }
            
		}

		return
			initbase;

	}
示例#13
0
文件: avl.c 项目: shijith/toy
void prints()
{
				tra(root);
}