<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[C++ deCasteljau obj. Loader]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich arbeite grad daran eine Bezierkurve mit dem deCasteljau algorithmus in C++ zu programmieren. Das ganze soll eine .obj Datei laden, die die Daten einer Bezierkurve hat.<br />
Das ganze soll dann später über Opengl gezeichnet werden, aber erstmal muss die Objloader Klasse in c++ stehen.</p>
<p>Die Datei ist dann so aufgebaut z.B.:</p>
<pre><code>v 0.0 0.0 0.0
v 0.0 1.0 0.0
v 1.0 1.0 0.0
v 1.0 0.0 0.0
cstype bezier
deg 3
curv 1 2 3 4
end
</code></pre>
<p>Ich habe schon ein Grundgerüst der Klasse Objloader, aber ich weiß nicht wie ich die deg, curv und ctype implementieren soll.</p>
<p>Also die Klasse sieht ungefähr so aus:</p>
<pre><code>struct Vertex	{ 
	float x,y,z; 
public: 
	//vertex = Punktkoordinate
	Vertex(float gx=0, float gy=0, float gz=0) { 
		x=gx;y=gy;z=gz;
	}
	void Add(Vertex v) {
		x+=v.x;
		y+=v.y;
		z+=v.z;
	}
};

struct UV		
{
 float s,t;
 };

struct Face		
{ 
unsigned short a, b, c; 
};

//hier bin ich mir unsicher ..........
struct Degree 
{ 
float d;
};

struct Curve {
	float v;

	int order; 
	struct Vertex vertex[];	
};

class  Mesh {
	friend class ObjLoader;
	public:
		Mesh();
		~Mesh();
		float*			GetVertexPointer();
		float*			GetNormalPointer();
		float*			GetTexCoordPointer();
		unsigned short* GetIndexPointer();
		unsigned int	GetFacesSize();
		unsigned int	GetVerticesSize();
		unsigned int	GetUVSize();
		unsigned int	GetNormalsSize();
		void			CalcNormals();
	private:

		string			name;
		vector&lt;Vertex&gt;	vertices;
		vector&lt;Vertex&gt;	normals;
		vector&lt;UV&gt;		uvs;
		vector&lt;Face&gt;	faces;		
};
</code></pre>
<p>Die If-Abfragen würde ich so machen:</p>
<pre><code>if(prefix.compare(&quot;cstype&quot;)== 0)
		{
			line = line.find_first_of(&quot;bezier&quot;) != -1; 
			continue;
		}
</code></pre>
<p>Kann mir einer da helfen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/317320/c-decasteljau-obj-loader</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Jul 2026 01:19:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/317320.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 04 Jun 2013 18:45:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ deCasteljau obj. Loader on Tue, 04 Jun 2013 18:45:57 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich arbeite grad daran eine Bezierkurve mit dem deCasteljau algorithmus in C++ zu programmieren. Das ganze soll eine .obj Datei laden, die die Daten einer Bezierkurve hat.<br />
Das ganze soll dann später über Opengl gezeichnet werden, aber erstmal muss die Objloader Klasse in c++ stehen.</p>
<p>Die Datei ist dann so aufgebaut z.B.:</p>
<pre><code>v 0.0 0.0 0.0
v 0.0 1.0 0.0
v 1.0 1.0 0.0
v 1.0 0.0 0.0
cstype bezier
deg 3
curv 1 2 3 4
end
</code></pre>
<p>Ich habe schon ein Grundgerüst der Klasse Objloader, aber ich weiß nicht wie ich die deg, curv und ctype implementieren soll.</p>
<p>Also die Klasse sieht ungefähr so aus:</p>
<pre><code>struct Vertex	{ 
	float x,y,z; 
public: 
	//vertex = Punktkoordinate
	Vertex(float gx=0, float gy=0, float gz=0) { 
		x=gx;y=gy;z=gz;
	}
	void Add(Vertex v) {
		x+=v.x;
		y+=v.y;
		z+=v.z;
	}
};

struct UV		
{
 float s,t;
 };

struct Face		
{ 
unsigned short a, b, c; 
};

//hier bin ich mir unsicher ..........
struct Degree 
{ 
float d;
};

struct Curve {
	float v;

	int order; 
	struct Vertex vertex[];	
};

class  Mesh {
	friend class ObjLoader;
	public:
		Mesh();
		~Mesh();
		float*			GetVertexPointer();
		float*			GetNormalPointer();
		float*			GetTexCoordPointer();
		unsigned short* GetIndexPointer();
		unsigned int	GetFacesSize();
		unsigned int	GetVerticesSize();
		unsigned int	GetUVSize();
		unsigned int	GetNormalsSize();
		void			CalcNormals();
	private:

		string			name;
		vector&lt;Vertex&gt;	vertices;
		vector&lt;Vertex&gt;	normals;
		vector&lt;UV&gt;		uvs;
		vector&lt;Face&gt;	faces;		
};
</code></pre>
<p>Die If-Abfragen würde ich so machen:</p>
<pre><code>if(prefix.compare(&quot;cstype&quot;)== 0)
		{
			line = line.find_first_of(&quot;bezier&quot;) != -1; 
			continue;
		}
</code></pre>
<p>Kann mir einer da helfen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2328627</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2328627</guid><dc:creator><![CDATA[greenyCoder]]></dc:creator><pubDate>Tue, 04 Jun 2013 18:45:57 GMT</pubDate></item></channel></rss>