Loaded obj model flickers and crashes application - c++

I'm trying to load model from obj file and display it in OpenGL 2.0 but I have two problems.
Loaded model sometimes flickers and crashes my application randomly.
I have no idea what causes exception because I don't have even a stacktrace.
I only have "Frame not in module" and message:
Exception thrown at 0x000000CE25E7FF68 in Clock.exe: 0xC0000005: Access violation reading location 0x000000CE26640000.
Do you have any idea what is wrong? Code? File?
ObjLoader.h:
#pragma once
#include <vector>
using namespace std;
typedef struct _vertex {
float x, y, z;
} Vertex;
typedef struct _face {
unsigned int v, vn;
} Face;
struct ObjModel
{
vector<Vertex> Vertices;
vector<Vertex> Normals;
vector<vector<Face>> Faces;
};
class ObjLoader
{
public:
ObjModel LoadObjModel(const char* filePath);
private:
void ProcessIndices(ObjModel &model);
void ProcessLine(string &dataType, stringstream &ss, ObjModel &model);
Vertex ObjLoader::GetVertex(stringstream &ss);
vector<Face> ObjLoader::GetFaces(stringstream &ss);
};
ObjLoader.cpp:
#include "ObjLoader.h"
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <vector>
using namespace std;
ObjModel ObjLoader::LoadObjModel(const char* filePath)
{
ObjModel model;
fstream in(filePath);
string line;
while (std::getline(in, line))
{
if (line.empty())
{
continue;
}
string dataType = line.substr(0, 2);
line = line.substr(2, line.size() - 2);
if (line[0] == ' ')
{
line = line.substr(1, line.size() - 1);
}
stringstream ss(line);
ProcessLine(dataType, ss, model);
}
ProcessIndices(model);
return model;
}
void ObjLoader::ProcessLine(string &dataType, stringstream &ss, ObjModel &model)
{
if (dataType == "v ")
{
model.Vertices.push_back(GetVertex(ss));
}
else if (dataType == "vn")
{
model.Normals.push_back(GetVertex(ss));
}
else if (dataType == "f ")
{
vector<Face> faces = GetFaces(ss);
model.Faces.push_back(faces);
}
}
Vertex ObjLoader::GetVertex(stringstream &ss)
{
Vertex vertex;
ss >> vertex.x >> vertex.y >> vertex.z;
return vertex;
}
vector<Face> ObjLoader::GetFaces(stringstream &ss)
{
vector<Face> faces;
string s;
while (getline(ss, s, ' '))
{
Face face;
int a, b;
sscanf(s.c_str(), "%d//%d", &a, &b);
face.v = a;
face.vn = b;
faces.push_back(face);
}
return faces;
}
void ObjLoader::ProcessIndices(ObjModel &model)
{
ObjModel temp;
temp.Vertices = vector<Vertex>();
temp.Normals = vector<Vertex>();
for (int i = 0; i < model.Faces.size(); i++)
{
for (int j = 0; j < model.Faces[i].size(); j++)
{
unsigned int vertexIndex = model.Faces[i][j].v - 1;
unsigned int normalIndex = model.Faces[i][j].vn - 1;
Vertex vertex = model.Vertices[vertexIndex];
Vertex normal = model.Normals[normalIndex];
temp.Vertices.push_back(vertex);
temp.Normals.push_back(vertex);
}
}
model.Vertices = temp.Vertices;
model.Normals = temp.Normals;
}
Displaying model:
float *vertices, *normals;
vertices = &model.Vertices[0].x;
normals = &model.Normals[0].x;
glEnable(GL_NORMALIZE);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertices);
glNormalPointer(GL_FLOAT, sizeof(float) * 4,normals);
glDrawArrays(GL_TRIANGLES, 0, model.Vertices.size());
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
Obj file:
v -0.048773 -0.250000 -1.004804
v -0.048773 0.250000 -1.004804
v 0.243863 0.250000 -0.975982
v 0.243863 -0.250000 -0.975982
v 0.784410 -0.250000 -0.156029
v 1.004804 -0.250000 -0.048773
v 0.975982 -0.250000 0.243863
v 0.738899 -0.250000 0.306062
v 0.664991 -0.250000 0.444333
v 0.744991 -0.250000 0.676016
v 0.517686 -0.250000 0.862560
v 0.306062 -0.250000 0.738899
v 0.156029 -0.250000 0.784410
v 0.048772 -0.250000 1.004804
v -0.243863 -0.250000 0.975981
v -0.306062 -0.250000 0.738898
v -0.444333 -0.250000 0.664991
v -0.676017 -0.250000 0.744991
v -0.862561 -0.250000 0.517685
v -0.738899 -0.250000 0.306061
v -0.784411 -0.250000 0.156028
v -0.293088 -0.250000 -0.006913
v -0.287323 -0.250000 0.051614
v -0.270251 -0.250000 0.107892
v -0.242528 -0.250000 0.159758
v -0.205220 -0.250000 0.205219
v -0.159759 -0.250000 0.242528
v -0.107893 -0.250000 0.270251
v -0.051615 -0.250000 0.287323
v 0.006912 -0.250000 0.293088
v 0.065440 -0.250000 0.287323
v 0.121718 -0.250000 0.270251
v 0.173584 -0.250000 0.242528
v 0.219045 -0.250000 0.205220
v 0.256353 -0.250000 0.159759
v 0.284076 -0.250000 0.107892
v 0.301148 -0.250000 0.051615
v 0.306913 -0.250000 -0.006913
v 0.306062 -0.250000 -0.738899
v 0.444333 -0.250000 -0.664991
v 0.676016 -0.250000 -0.744991
v 0.862560 -0.250000 -0.517686
v 0.738899 -0.250000 -0.306062
v 0.301148 -0.250000 -0.065440
v 0.284076 -0.250000 -0.121718
v 0.256353 -0.250000 -0.173584
v 0.219045 -0.250000 -0.219045
v 0.173584 -0.250000 -0.256353
v 0.121718 -0.250000 -0.284076
v 0.065440 -0.250000 -0.301148
v 0.006913 -0.250000 -0.306913
v -0.051614 -0.250000 -0.301148
v -0.107892 -0.250000 -0.284077
v -0.159758 -0.250000 -0.256354
v -0.205219 -0.250000 -0.219045
v -0.242528 -0.250000 -0.173584
v -0.270251 -0.250000 -0.121718
v -0.287323 -0.250000 -0.065440
v -1.004804 -0.250000 0.048772
v -0.975981 -0.250000 -0.243864
v -0.738898 -0.250000 -0.306063
v -0.664991 -0.250000 -0.444334
v -0.744990 -0.250000 -0.676017
v -0.517685 -0.250000 -0.862561
v -0.306061 -0.250000 -0.738899
v -0.156028 -0.250000 -0.784411
v -0.156028 0.250000 -0.784411
v -0.306061 0.250000 -0.738899
v -0.517685 0.250000 -0.862561
v -0.744990 0.250000 -0.676017
v -0.664991 0.250000 -0.444334
v -0.738898 0.250000 -0.306063
v -0.975981 0.250000 -0.243864
v -1.004804 0.250000 0.048772
v -0.784411 0.250000 0.156028
v -0.738899 0.250000 0.306061
v -0.862561 0.250000 0.517685
v -0.676017 0.250000 0.744991
v -0.444333 0.250000 0.664991
v -0.306062 0.250000 0.738898
v -0.243863 0.250000 0.975981
v 0.048772 0.250000 1.004804
v 0.156029 0.250000 0.784410
v 0.006912 0.250000 0.293088
v -0.051615 0.250000 0.287323
v -0.107893 0.250000 0.270251
v -0.159759 0.250000 0.242528
v -0.205220 0.250000 0.205219
v -0.242528 0.250000 0.159758
v -0.270251 0.250000 0.107892
v -0.287323 0.250000 0.051614
v -0.293088 0.250000 -0.006913
v -0.287323 0.250000 -0.065440
v -0.270251 0.250000 -0.121718
v -0.242528 0.250000 -0.173584
v -0.205219 0.250000 -0.219045
v -0.159758 0.250000 -0.256354
v -0.107892 0.250000 -0.284077
v -0.051614 0.250000 -0.301148
v 0.006913 0.250000 -0.306913
v 0.306062 0.250000 -0.738899
v 0.065440 0.250000 -0.301148
v 0.121718 0.250000 -0.284076
v 0.173584 0.250000 -0.256353
v 0.219045 0.250000 -0.219045
v 0.256353 0.250000 -0.173584
v 0.284076 0.250000 -0.121718
v 0.301148 0.250000 -0.065440
v 0.306913 0.250000 -0.006913
v 0.301148 0.250000 0.051615
v 0.284076 0.250000 0.107892
v 0.256353 0.250000 0.159759
v 0.219045 0.250000 0.205220
v 0.173584 0.250000 0.242528
v 0.121718 0.250000 0.270251
v 0.065440 0.250000 0.287323
v 0.306062 0.250000 0.738899
v 0.517686 0.250000 0.862560
v 0.744991 0.250000 0.676016
v 0.664991 0.250000 0.444333
v 0.738899 0.250000 0.306062
v 0.975982 0.250000 0.243863
v 1.004804 0.250000 -0.048773
v 0.784410 0.250000 -0.156029
v 0.738899 0.250000 -0.306062
v 0.862560 0.250000 -0.517686
v 0.676016 0.250000 -0.744991
v 0.444333 0.250000 -0.664991
vn 0.0980 0.0000 -0.9952
vn 0.0000 -1.0000 -0.0000
vn -0.8992 0.0000 -0.4376
vn 0.0000 1.0000 0.0000
vn 0.9673 0.0000 -0.2538
vn 0.4714 0.0000 -0.8819
vn -0.3264 0.0000 -0.9452
vn 0.7730 0.0000 -0.6344
vn 0.8634 0.0000 0.5045
vn 0.9569 0.0000 -0.2903
vn 0.4376 0.0000 -0.8992
vn 0.9952 0.0000 0.0980
vn 0.2538 0.0000 0.9673
vn 0.8819 0.0000 0.4714
vn 0.9452 0.0000 -0.3264
vn 0.6344 0.0000 0.7730
vn -0.5045 0.0000 0.8634
vn 0.2903 0.0000 0.9569
vn 0.8992 0.0000 0.4376
vn -0.0980 0.0000 0.9952
vn -0.9673 0.0000 0.2538
vn -0.4714 0.0000 0.8819
vn 0.3264 0.0000 0.9452
vn -0.7730 0.0000 0.6344
vn -0.8634 0.0000 -0.5045
vn -0.9569 0.0000 0.2903
vn -0.4376 0.0000 0.8992
vn -0.9952 0.0000 -0.0980
vn -0.2538 0.0000 -0.9673
vn -0.8819 0.0000 -0.4714
vn -0.9452 0.0000 0.3264
vn -0.6344 0.0000 -0.7730
vn 0.5045 0.0000 -0.8634
vn -0.2903 0.0000 -0.9569
vn 0.0980 0.0000 0.9952
vn -0.2903 0.0000 0.9569
vn 0.4714 0.0000 0.8819
vn -0.6344 0.0000 0.7730
vn 0.7730 0.0000 0.6344
vn -0.8819 0.0000 0.4714
vn 0.9569 0.0000 0.2903
vn -0.9952 0.0000 0.0980
vn 0.9952 0.0000 -0.0980
vn -0.9569 0.0000 -0.2903
vn 0.8819 0.0000 -0.4714
vn -0.7730 0.0000 -0.6344
vn 0.6344 0.0000 -0.7730
vn -0.4714 0.0000 -0.8819
vn 0.2903 0.0000 -0.9569
vn -0.0980 0.0000 -0.9952
s off
f 2//1 4//1 1//1
f 16//2 28//2 29//2
f 51//2 52//2 66//2
f 67//3 1//3 66//3
f 79//4 87//4 88//4
f 111//4 112//4 121//4
f 3//5 39//5 4//5
f 101//6 40//6 39//6
f 128//7 41//7 40//7
f 127//8 42//8 41//8
f 126//9 43//9 42//9
f 125//10 5//10 43//10
f 124//11 6//11 5//11
f 123//12 7//12 6//12
f 122//13 8//13 7//13
f 121//14 9//14 8//14
f 120//15 10//15 9//15
f 119//16 11//16 10//16
f 118//17 12//17 11//17
f 117//18 13//18 12//18
f 83//19 14//19 13//19
f 82//20 15//20 14//20
f 81//21 16//21 15//21
f 80//22 17//22 16//22
f 79//23 18//23 17//23
f 78//24 19//24 18//24
f 77//25 20//25 19//25
f 76//26 21//26 20//26
f 75//27 59//27 21//27
f 74//28 60//28 59//28
f 73//29 61//29 60//29
f 72//30 62//30 61//30
f 71//31 63//31 62//31
f 70//32 64//32 63//32
f 69//33 65//33 64//33
f 68//34 66//34 65//34
f 50//20 100//20 51//20
f 51//35 99//35 52//35
f 49//36 102//36 50//36
f 52//18 98//18 53//18
f 48//22 103//22 49//22
f 53//37 97//37 54//37
f 47//38 104//38 48//38
f 54//16 96//16 55//16
f 46//24 105//24 47//24
f 55//39 95//39 56//39
f 45//40 106//40 46//40
f 56//14 94//14 57//14
f 44//26 107//26 45//26
f 57//41 93//41 58//41
f 38//42 108//42 44//42
f 58//12 92//12 22//12
f 37//28 109//28 38//28
f 22//43 91//43 23//43
f 36//44 110//44 37//44
f 23//10 90//10 24//10
f 35//30 111//30 36//30
f 24//45 89//45 25//45
f 34//46 112//46 35//46
f 25//8 88//8 26//8
f 33//32 113//32 34//32
f 26//47 87//47 27//47
f 32//48 114//48 33//48
f 27//6 86//6 28//6
f 31//34 115//34 32//34
f 28//49 85//49 29//49
f 30//50 116//50 31//50
f 29//1 84//1 30//1
f 2//1 3//1 4//1
f 38//2 5//2 37//2
f 6//2 7//2 8//2
f 9//2 10//2 12//2
f 5//2 6//2 8//2
f 10//2 11//2 12//2
f 5//2 8//2 37//2
f 37//2 8//2 36//2
f 35//2 36//2 8//2
f 13//2 14//2 16//2
f 14//2 15//2 16//2
f 9//2 35//2 8//2
f 9//2 34//2 35//2
f 13//2 16//2 29//2
f 17//2 18//2 19//2
f 20//2 21//2 24//2
f 17//2 19//2 20//2
f 9//2 33//2 34//2
f 9//2 12//2 33//2
f 16//2 17//2 27//2
f 21//2 22//2 23//2
f 21//2 23//2 24//2
f 33//2 12//2 32//2
f 32//2 12//2 31//2
f 20//2 24//2 25//2
f 20//2 25//2 26//2
f 31//2 12//2 13//2
f 30//2 31//2 13//2
f 17//2 20//2 26//2
f 17//2 26//2 27//2
f 29//2 30//2 13//2
f 16//2 27//2 28//2
f 66//2 1//2 4//2
f 66//2 4//2 39//2
f 63//2 64//2 65//2
f 65//2 66//2 53//2
f 40//2 41//2 42//2
f 66//2 39//2 51//2
f 62//2 63//2 65//2
f 59//2 60//2 61//2
f 61//2 57//2 58//2
f 39//2 40//2 49//2
f 43//2 5//2 44//2
f 40//2 42//2 43//2
f 59//2 61//2 21//2
f 22//2 61//2 58//2
f 22//2 21//2 61//2
f 5//2 38//2 44//2
f 43//2 44//2 45//2
f 61//2 62//2 57//2
f 57//2 62//2 56//2
f 43//2 45//2 46//2
f 43//2 46//2 40//2
f 56//2 62//2 55//2
f 55//2 62//2 65//2
f 40//2 46//2 47//2
f 40//2 47//2 48//2
f 54//2 55//2 65//2
f 53//2 54//2 65//2
f 40//2 48//2 49//2
f 39//2 49//2 50//2
f 52//2 53//2 66//2
f 39//2 50//2 51//2
f 67//3 2//3 1//3
f 3//4 2//4 67//4
f 68//4 69//4 71//4
f 101//4 3//4 67//4
f 69//4 70//4 71//4
f 101//4 67//4 100//4
f 99//4 100//4 67//4
f 98//4 99//4 67//4
f 67//4 68//4 98//4
f 72//4 73//4 74//4
f 68//4 71//4 96//4
f 97//4 98//4 68//4
f 96//4 97//4 68//4
f 71//4 95//4 96//4
f 72//4 74//4 75//4
f 71//4 94//4 95//4
f 76//4 77//4 79//4
f 72//4 94//4 71//4
f 72//4 93//4 94//4
f 77//4 78//4 79//4
f 80//4 81//4 82//4
f 76//4 79//4 88//4
f 72//4 92//4 93//4
f 72//4 75//4 92//4
f 79//4 80//4 87//4
f 82//4 83//4 80//4
f 83//4 84//4 85//4
f 92//4 75//4 91//4
f 91//4 75//4 90//4
f 80//4 83//4 85//4
f 80//4 85//4 86//4
f 90//4 75//4 76//4
f 89//4 90//4 76//4
f 80//4 86//4 87//4
f 88//4 89//4 76//4
f 128//4 101//4 103//4
f 101//4 100//4 102//4
f 126//4 127//4 125//4
f 125//4 127//4 128//4
f 101//4 102//4 103//4
f 128//4 103//4 104//4
f 124//4 125//4 108//4
f 122//4 123//4 121//4
f 121//4 123//4 124//4
f 125//4 128//4 106//4
f 128//4 104//4 105//4
f 120//4 121//4 112//4
f 118//4 119//4 117//4
f 84//4 83//4 116//4
f 117//4 119//4 120//4
f 128//4 105//4 106//4
f 125//4 106//4 107//4
f 117//4 120//4 114//4
f 116//4 83//4 117//4
f 115//4 116//4 117//4
f 125//4 107//4 108//4
f 124//4 108//4 109//4
f 114//4 115//4 117//4
f 113//4 114//4 120//4
f 121//4 124//4 110//4
f 124//4 109//4 110//4
f 112//4 113//4 120//4
f 121//4 110//4 111//4
f 3//5 101//5 39//5
f 101//6 128//6 40//6
f 128//7 127//7 41//7
f 127//8 126//8 42//8
f 126//9 125//9 43//9
f 125//10 124//10 5//10
f 124//11 123//11 6//11
f 123//12 122//12 7//12
f 122//13 121//13 8//13
f 121//14 120//14 9//14
f 120//15 119//15 10//15
f 119//16 118//16 11//16
f 118//17 117//17 12//17
f 117//18 83//18 13//18
f 83//19 82//19 14//19
f 82//20 81//20 15//20
f 81//21 80//21 16//21
f 80//22 79//22 17//22
f 79//23 78//23 18//23
f 78//24 77//24 19//24
f 77//25 76//25 20//25
f 76//26 75//26 21//26
f 75//27 74//27 59//27
f 74//28 73//28 60//28
f 73//29 72//29 61//29
f 72//30 71//30 62//30
f 71//31 70//31 63//31
f 70//32 69//32 64//32
f 69//33 68//33 65//33
f 68//34 67//34 66//34
f 50//20 102//20 100//20
f 51//35 100//35 99//35
f 49//36 103//36 102//36
f 52//18 99//18 98//18
f 48//22 104//22 103//22
f 53//37 98//37 97//37
f 47//38 105//38 104//38
f 54//16 97//16 96//16
f 46//24 106//24 105//24
f 55//39 96//39 95//39
f 45//40 107//40 106//40
f 56//14 95//14 94//14
f 44//26 108//26 107//26
f 57//41 94//41 93//41
f 38//42 109//42 108//42
f 58//12 93//12 92//12
f 37//28 110//28 109//28
f 22//43 92//43 91//43
f 36//44 111//44 110//44
f 23//10 91//10 90//10
f 35//30 112//30 111//30
f 24//45 90//45 89//45
f 34//46 113//46 112//46
f 25//8 89//8 88//8
f 33//32 114//32 113//32
f 26//47 88//47 87//47
f 32//48 115//48 114//48
f 27//6 87//6 86//6
f 31//34 116//34 115//34
f 28//49 86//49 85//49
f 30//50 84//50 116//50
f 29//1 85//1 84//1

I'm going to say that glNormalPointer(GL_FLOAT, sizeof(float) * 4,normals); is causing your problems. First off, you only have 3 components in your normals, not four. I bet this is causing glDrawArrays to access out of bounds memory.
Also, because your normals are not walked correctly you could be getting garbage and it would cause some flickering.
Because your normals are tightly packed, just use 0 for the stride.

Related

Gstreamer1.0 missing element : v4l2h264enc in Qualcomm RB5

Before starting I am aware there are almost same questions with what I will ask, but since the question is almost board specific I will still ask.
I have a Qualcomm RB5 Robotic Vision Kit which has ov9282 camera. I configured a lighter Ubuntu 18.04, and kernel version is 5.15.0(5.15.0-qcomlt-arm64). I have built the gstreamer1.0(1.20.2) from source code. The meson command I used:
meson configure build -Dgst-plugins-bad:v4l2codecs=enabled -Dgst-plugins-good:v4l2=enabled -Dgst-plugins-good:v4l2-gudev=enabled
As you can see, I enabled all v4l2 related plugins and elements, and it seems I was successful partially. After meson, I executed ninja install to create symlinks. So far I haven't encountered with a problem. when I prompt gst-inspect-1.0 video4linux2, it shows elements in the .so file.
root#linaro-developer:~# gst-inspect-1.0 video4linux2
Plugin Details:
Name video4linux2
Description elements for Video 4 Linux
Filename /usr/local/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvideo4linux2.so
Version 1.20.2.1
License LGPL
Source module gst-plugins-good
Binary package GStreamer Good Plug-ins git
Origin URL Unknown package origin
v4l2deviceprovider: Video (video4linux2) Device Provider
v4l2h264dec: V4L2 H264 Decoder
v4l2h265dec: V4L2 H265 Decoder
v4l2mpeg2dec: V4L2 MPEG2 Decoder
v4l2radio: Radio (video4linux2) Tuner
v4l2sink: Video (video4linux2) Sink
v4l2src: Video (video4linux2) Source
v4l2vp8dec: V4L2 VP8 Decoder
v4l2vp9dec: V4L2 VP9 Decoder
9 features:
+-- 8 elements
+-- 1 device providers
However, in the build directory I can see gstv4l2h264enc.c.o file which I need.
root#linaro-developer:/home/linaro/gstreamer/build/subprojects/gst-plugins-good/sys/v4l2/libgstvideo4linux2.so.p# ls
gstv4l2.c.o gstv4l2colorbalance.c.o gstv4l2h263enc.c.o gstv4l2h265enc.c.o gstv4l2mpeg4enc.c.o gstv4l2src.c.o gstv4l2videoenc.c.o gstv4l2vp9codec.c.o tunernorm.c.o
gstv4l2allocator.c.o gstv4l2deviceprovider.c.o gstv4l2h264codec.c.o gstv4l2jpegenc.c.o gstv4l2object.c.o gstv4l2transform.c.o gstv4l2vidorient.c.o gstv4l2vp9enc.c.o v4l2-utils.c.o
gstv4l2bufferpool.c.o gstv4l2element.c.o gstv4l2h264enc.c.o gstv4l2mpeg2codec.c.o gstv4l2radio.c.o gstv4l2tuner.c.o gstv4l2vp8codec.c.o tuner.c.o v4l2_calls.c.o
gstv4l2codec.c.o gstv4l2fwhtenc.c.o gstv4l2h265codec.c.o gstv4l2mpeg4codec.c.o gstv4l2sink.c.o gstv4l2videodec.c.o gstv4l2vp8enc.c.o tunerchannel.c.o
Moreover, I viewed the content of the .so file to be sure I built the gstv4l2 module correctly. Output of nm -D libgstvideo4linux2.so, I can see the encoding parameters in the file.
U GST_CAT_DEFAULT
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
w __cxa_finalize#GLIBC_2.17
U __errno_location#GLIBC_2.17
U __getauxval#GLIBC_2.17
w __gmon_start__
U _gst_caps_features_memory_system_memory
U _gst_caps_type
U _gst_debug_category_new
U _gst_debug_get_category
U _gst_debug_min
U _gst_debug_register_funcptr
U _gst_element_error_printf
U _gst_fraction_range_type
U _gst_fraction_type
U _gst_int_range_type
U _gst_structure_type
U _gst_value_list_type
U clock_gettime#GLIBC_2.17
U close#GLIBC_2.17
U dup#GLIBC_2.17
U g_ascii_strcasecmp
U g_ascii_strdown
U g_ascii_strtod
U g_ascii_table
U g_ascii_tolower
U g_assertion_message_expr
U g_clear_error
U g_cond_broadcast
U g_cond_clear
U g_cond_init
U g_cond_signal
U g_cond_wait
U g_datalist_clear
U g_datalist_id_get_data
U g_datalist_id_set_data_full
U g_enum_register_static
U g_error_new_literal
U g_flags_register_static
U g_free
U g_get_real_time
U g_getenv
U g_idle_source_new
U g_intern_static_string
U g_list_delete_link
U g_list_find_custom
U g_list_foreach
U g_list_free
U g_list_free_full
U g_list_insert_sorted_with_data
U g_list_prepend
U g_list_remove
U g_list_reverse
U g_list_sort
U g_log
U g_main_context_new
U g_main_context_push_thread_default
U g_main_context_ref
U g_main_context_unref
U g_main_loop_new
U g_main_loop_quit
U g_main_loop_ref
U g_main_loop_run
U g_main_loop_unref
U g_malloc
U g_malloc0
U g_mutex_lock
U g_mutex_unlock
U g_object_class_install_property
U g_object_get
U g_object_new
U g_object_ref
U g_object_ref_sink
U g_object_set
U g_object_unref
U g_once_init_enter
U g_once_init_leave
U g_param_spec_boolean
U g_param_spec_boxed
U g_param_spec_enum
U g_param_spec_flags
U g_param_spec_int
U g_param_spec_string
U g_param_spec_uint
U g_path_get_basename
U g_quark_from_string
U g_quark_to_string
U g_queue_clear
U g_queue_foreach
U g_queue_push_tail
U g_rec_mutex_lock
U g_rec_mutex_unlock
U g_return_if_fail_warning
U g_set_error_literal
U g_signal_connect_data
U g_signal_emit
U g_signal_emit_by_name
U g_signal_handler_block
U g_signal_handler_disconnect
U g_signal_handler_unblock
U g_signal_new
U g_slice_alloc
U g_slice_free1
U g_slist_foreach
U g_slist_free
U g_slist_insert_sorted
U g_source_attach
U g_source_set_callback
U g_source_unref
U g_str_equal
U g_strcmp0
U g_strconcat
U g_strdup
U g_strdup_printf
U g_strerror
U g_thread_join
U g_thread_new
U g_type_add_interface_static
U g_type_check_instance_is_a
U g_type_check_value
U g_type_check_value_holds
U g_type_class_adjust_private_offset
U g_type_class_peek_parent
U g_type_from_name
U g_type_interface_peek
U g_type_name
U g_type_query
U g_type_register_static
U g_type_register_static_simple
U g_udev_client_new
U g_udev_client_query_by_subsystem
U g_udev_device_get_device_file
U g_udev_device_get_property
U g_udev_device_get_property_as_int
U g_udev_device_get_sysfs_path
U g_value_copy
U g_value_dup_string
U g_value_get_boolean
U g_value_get_enum
U g_value_get_int
U g_value_get_string
U g_value_get_uint
U g_value_init
U g_value_set_boolean
U g_value_set_enum
U g_value_set_flags
U g_value_set_int
U g_value_set_string
U g_value_set_uint
U g_value_take_string
U g_value_transform
U g_value_unset
U gst_allocator_get_type
U gst_atomic_queue_length
U gst_atomic_queue_new
U gst_atomic_queue_pop
U gst_atomic_queue_push
U gst_atomic_queue_unref
U gst_base_sink_wait_preroll
U gst_base_src_get_allocator
U gst_base_src_get_buffer_pool
U gst_base_src_negotiate
U gst_base_src_set_caps
U gst_base_src_set_format
U gst_base_src_set_live
U gst_base_transform_get_buffer_pool
U gst_base_transform_get_type
U gst_base_transform_is_passthrough
U gst_base_transform_set_passthrough
U gst_base_transform_set_qos_enabled
U gst_buffer_add_video_meta_full
U gst_buffer_append_memory
U gst_buffer_copy_into
U gst_buffer_copy_region
U gst_buffer_fill
U gst_buffer_get_size
U gst_buffer_get_video_meta
U gst_buffer_map
U gst_buffer_n_memory
U gst_buffer_new
U gst_buffer_new_allocate
U gst_buffer_peek_memory
U gst_buffer_pool_acquire_buffer
U gst_buffer_pool_config_add_option
U gst_buffer_pool_config_get_allocator
U gst_buffer_pool_config_get_params
U gst_buffer_pool_config_has_option
U gst_buffer_pool_config_set_allocator
U gst_buffer_pool_config_set_params
U gst_buffer_pool_config_validate_params
U gst_buffer_pool_get_config
U gst_buffer_pool_get_type
U gst_buffer_pool_is_active
U gst_buffer_pool_set_active
U gst_buffer_pool_set_config
U gst_buffer_pool_set_flushing
U gst_buffer_resize
U gst_buffer_unmap
U gst_caps_append
U gst_caps_append_structure
U gst_caps_append_structure_full
U gst_caps_can_intersect
U gst_caps_copy_nth
U gst_caps_features_copy
U gst_caps_features_is_any
U gst_caps_features_is_equal
U gst_caps_features_new
U gst_caps_fixate
U gst_caps_foreach
U gst_caps_get_features
U gst_caps_get_size
U gst_caps_get_structure
U gst_caps_intersect
U gst_caps_intersect_full
U gst_caps_is_any
U gst_caps_is_empty
U gst_caps_is_equal
U gst_caps_is_fixed
U gst_caps_is_subset
U gst_caps_is_subset_structure_full
U gst_caps_map_in_place
U gst_caps_merge
U gst_caps_new_empty
U gst_caps_normalize
U gst_caps_set_features
U gst_caps_set_value
U gst_caps_simplify
U gst_caps_truncate
U gst_clock_get_time
U gst_color_balance_channel_get_type
U gst_color_balance_get_type
U gst_core_error_quark
U gst_debug_log
U gst_device_get_type
U gst_device_provider_class_set_static_metadata
U gst_device_provider_device_add
U gst_device_provider_device_remove
U gst_device_provider_get_type
U gst_device_provider_register
U gst_dmabuf_allocator_new
U gst_dmabuf_memory_get_fd
U gst_element_class_add_pad_template
U gst_element_class_set_metadata
U gst_element_class_set_static_metadata
U gst_element_factory_make
U gst_element_get_type
U gst_element_message_full
U gst_element_post_message
U gst_element_register
U gst_fd_allocator_alloc
U gst_flow_get_name
U gst_is_dmabuf_memory
U gst_memory_get_sizes
U gst_memory_init
U gst_memory_is_type
U gst_memory_resize
U gst_message_new_qos
U gst_mini_object_copy
U gst_mini_object_get_qdata
U gst_mini_object_is_writable
U gst_mini_object_make_writable
U gst_mini_object_ref
U gst_mini_object_replace
U gst_mini_object_set_qdata
U gst_mini_object_steal_qdata
U gst_mini_object_unref
U gst_object_get_name
U gst_object_ref
U gst_object_ref_sink
U gst_object_sync_values
U gst_object_unref
U gst_pad_get_allowed_caps
U gst_pad_get_current_caps
U gst_pad_get_pad_template_caps
U gst_pad_get_task_state
U gst_pad_pause_task
U gst_pad_peer_query
U gst_pad_peer_query_caps
U gst_pad_query_caps
U gst_pad_start_task
U gst_pad_stop_task
U gst_pad_template_new
U gst_plugin_add_dependency
U gst_plugin_register_static
000000000000aa50 T gst_plugin_video4linux2_get_desc
000000000000aa60 T gst_plugin_video4linux2_register
U gst_poll_add_fd
U gst_poll_fd_ctl_pri
U gst_poll_fd_ctl_read
U gst_poll_fd_ctl_write
U gst_poll_fd_has_error
U gst_poll_fd_has_pri
U gst_poll_fd_init
U gst_poll_free
U gst_poll_new
U gst_poll_set_flushing
U gst_poll_wait
U gst_push_src_get_type
U gst_query_add_allocation_meta
U gst_query_add_allocation_param
U gst_query_add_allocation_pool
U gst_query_find_allocation_meta
U gst_query_get_n_allocation_params
U gst_query_get_n_allocation_pools
U gst_query_new_allocation
U gst_query_parse_allocation
U gst_query_parse_caps
U gst_query_parse_nth_allocation_meta
U gst_query_parse_nth_allocation_param
U gst_query_parse_nth_allocation_pool
U gst_query_set_caps_result
U gst_query_set_latency
U gst_query_set_nth_allocation_param
U gst_query_set_nth_allocation_pool
U gst_resource_error_quark
U gst_static_caps_get
U gst_stream_error_quark
U gst_structure_copy
U gst_structure_fixate_field
U gst_structure_fixate_field_nearest_fraction
U gst_structure_fixate_field_nearest_int
U gst_structure_fixate_field_string
U gst_structure_foreach
U gst_structure_free
U gst_structure_get_fraction
U gst_structure_get_int
U gst_structure_get_name
U gst_structure_get_string
U gst_structure_get_uint
U gst_structure_get_value
U gst_structure_has_field
U gst_structure_has_name
U gst_structure_map_in_place
U gst_structure_n_fields
U gst_structure_new
U gst_structure_new_empty
U gst_structure_nth_field_name
U gst_structure_remove_field
U gst_structure_remove_fields
U gst_structure_set
U gst_structure_set_value
U gst_structure_take_value
U gst_structure_to_string
U gst_type_mark_as_plugin_api
U gst_uri_error_quark
U gst_uri_handler_get_type
U gst_util_fraction_multiply
U gst_util_greatest_common_divisor
U gst_util_uint64_scale_int
U gst_value_compare
U gst_value_fraction_subtract
U gst_value_get_fraction_denominator
U gst_value_get_fraction_numerator
U gst_value_get_structure
U gst_value_intersect
U gst_value_is_fixed
U gst_value_list_append_and_take_value
U gst_value_list_append_value
U gst_value_list_get_size
U gst_value_list_get_value
U gst_value_set_fraction
U gst_value_set_fraction_range_full
U gst_value_set_int_range_step
U gst_value_set_structure
U gst_value_subtract
U gst_video_alignment_reset
U gst_video_calculate_display_ratio
U gst_video_codec_frame_unref
U gst_video_codec_state_ref
U gst_video_codec_state_unref
U gst_video_colorimetry_is_equal
U gst_video_colorimetry_to_string
U gst_video_decoder_drop_frame
U gst_video_decoder_finish_frame
U gst_video_decoder_get_buffer_pool
U gst_video_decoder_get_frame
U gst_video_decoder_get_oldest_frame
U gst_video_decoder_get_type
U gst_video_decoder_negotiate
U gst_video_decoder_proxy_getcaps
U gst_video_decoder_set_latency
U gst_video_decoder_set_output_state
U gst_video_decoder_set_packetized
U gst_video_encoder_allocate_output_buffer
U gst_video_encoder_finish_frame
U gst_video_encoder_get_frame
U gst_video_encoder_get_oldest_frame
U gst_video_encoder_get_output_state
U gst_video_encoder_get_type
U gst_video_encoder_negotiate
U gst_video_encoder_set_latency
U gst_video_encoder_set_output_state
U gst_video_format_to_string
U gst_video_frame_copy
U gst_video_frame_map
U gst_video_frame_unmap
U gst_video_info_align_full
U gst_video_info_from_caps
U gst_video_info_init
U gst_video_info_set_interlaced_format
U gst_video_info_to_caps
U gst_video_interlace_mode_to_string
U gst_video_meta_api_get_type
U gst_video_meta_get_plane_height
U gst_video_meta_set_alignment
U gst_video_orientation_get_type
U gst_video_sink_get_type
U ioctl#GLIBC_2.17
U memcpy#GLIBC_2.17
U memset#GLIBC_2.17
U mmap64#GLIBC_2.17
U munmap#GLIBC_2.17
U open64#GLIBC_2.17
U read#GLIBC_2.17
U stat64#GLIBC_2.33
U strcmp#GLIBC_2.17
U strcpy#GLIBC_2.17
U strerror#GLIBC_2.17
U strlen#GLIBC_2.17
U strncpy#GLIBC_2.17
As the last step it is frustruating to see Gstreamer1.0 cannot find v4l2h264enc or any other encoding elements. The output of
root#linaro-developer:/home/linaro/gstreamer/build/subprojects/gst-plugins-good/sys/v4l2# gst-inspect-1.0 v4l2h264enc
No such element or plugin 'v4l2h264enc'
So where I am missing, any help, comment, or guidance will be appreciated a lot.
See which encoders are currently active on your gstreamer setup:
gst-inspect-1.0 | grep '264.*enc'
Maybe you could use one of the listed encoders instead.
See a similar issue on the Raspberry Pi at https://github.com/raspberrypi/linux/issues/3974

Simplify equations for a computer algebric system in ocaml

IHello! I'm currently trying to code in ocaml a programm to draw a function which was write by the user.
To do that, I'm parsing the input, I'm tranforming the input into a data structure.
I'm currently trying to create an ocaml function to simplify at maximum this input.
For example, x*x - x*x will simplify in 0
Here is my parser :
%{
open Function
%}
%token <float> FLOAT
%token <string> VAR
%token COS SIN SQRT EXP LN PUIS
%token PLUS MINUS TIMES DIV
%token LPAR RPAR
%token EOL
%left LPAR RPAR
%left COS SIN SQRT EXP LN
%left PLUS MINUS
%left TIMES DIV
%left PUIS
%type <Function.formel> main
%start main
%%
main:
expr EOL { $1 }
;
expr:
| FLOAT { flt $1 }
| VAR { var $1 }
| FLOAT VAR { mul (flt $1) (var $2) }
| LPAR expr RPAR { $2 }
| expr TIMES expr { mul $1 $3 }
| expr DIV expr { div $1 $3 }
| expr PLUS expr { add $1 $3 }
| expr MINUS expr { sub $1 $3 }
| expr PUIS expr { puis $1 $3 }
| COS LPAR expr RPAR { cos $3 }
| PLUS expr { pos $2 }
| MINUS expr { neg $2 }
| FLOAT COS LPAR expr RPAR { mul (flt $1) (cos $4) }
| SIN LPAR expr RPAR { sin $3 }
| FLOAT SIN LPAR expr RPAR { mul (flt $1) (sin $4) }
| SQRT LPAR expr RPAR { sqrt $3 }
| LN LPAR expr RPAR { lnp $3 }
| EXP LPAR expr RPAR { expo $3 }
;
Here is my lexer :
{
open Parser
exception Eof
}
rule token = parse
| [' ' '\t'] { token lexbuf }
| ['\n'] { EOL }
| ['0'-'9']+ as lxm { FLOAT (float_of_string lxm) }
| '+' { PLUS }
| '-' { MINUS }
| '*' { TIMES }
| '/' { DIV }
| '(' { LPAR }
| ')' { RPAR }
| '^' { PUIS }
| "cos" { COS }
| "sin" { SIN }
| "sqrt" { SQRT }
| "ln" { LN }
| "exp" { EXP }
| ['a'-'z']+ as lxm { VAR (lxm) }
| eof { raise Eof }
I think my parser and my lexer are good.
Then, I'm using a tree to store the function :
type formel =
| Float of float
| Var of string
| Add of formel * formel
| Sub of formel * formel
| Mul of formel * formel
| Div of formel * formel
| Ln of formel
| Cos of formel
| Sin of formel
| Puis of formel * formel
| Sqrt of formel
| Exp of formel
let flt f = Float f
let add e1 e2 = Add (e1, e2)
let sub e1 e2 = Sub (e1, e2)
let mul e1 e2 = Mul (e1, e2)
let div e1 e2 = Div (e1, e2)
let puis e1 e2 = Puis (e1, e2)
let neg e = Mul (Float (-1.), e)
let pos e = Mul (Float 1., e)
let cos e = Cos e
let sin e = Sin e
let var v = Var v
let sqrt e = Sqrt e
let expo e = Exp e
let lnp e = Ln e
And here is the difficulty where I am : the creation of a function to simplify.
let rec simplify f =
let f_simplify = simp f in
if f_simplify = f
then f_simplify
else simplify f_simplify
and simp f =
match f with
| Float f -> Float f
| Var x -> Var x
(* 0 + x -> x *)
| Add (Float 0., f) -> simp f
(* x + 0 -> x *)
| Add (f, Float 0.) -> simp f
(* f1 + f2-> calcul (f1 + f2) *)
| Add (Float f1, Float f2) -> Float (f1 +. f2)
(* x + x -> 2 * x *)
| Add (f, g) when f = g -> simp (Mul (Float 2., simp f))
(* f1 * x + x -> (f1 + 1) * x *)
| Add (Mul (Float f1, f), g) when f = g -> simp (Mul (Float (f1 +. 1.), simp f))
(* x + f1 * x -> (f1 + 1) * x *)
| Add (f, Mul (Float f1, g)) when f = g -> simp (Mul (Float (f1 +. 1.), simp f))
(* x * f1 + x -> (f1 + 1) * x *)
| Add (Mul (f, Float f1), g) when f = g -> simp (Mul (Float (f1 +. 1.), simp f))
(* x + x * f1 -> (f1 + 1) * x *)
| Add (f, Mul (g, Float f1)) when f = g -> simp (Mul (Float (f1 +. 1.), simp f))
(* f1 * x + f2 * x -> (f1 + f2) * x *)
| Add (Mul (Float f1, f), Mul (Float f2, g)) when f = g -> simp (Mul (Float (f1 +. f2), simp f))
(* x * f1 + f2 * x -> (f1 + f2) * x *)
| Add (Mul (f, Float f1), Mul (Float f2, g)) when f = g -> simp (Mul (Float (f1 +. f2), simp f))
(* f1 * x + x * f2 -> (f1 + f2) * x *)
| Add (Mul (Float f1, f), Mul (g, Float f2)) when f = g -> simp (Mul (Float (f1 +. f2), simp f))
(* x * f1 + x * f2 -> (f1 + f2) * x *)
| Add (Mul (f, Float f1), Mul (g, Float f2)) when f = g -> simp (Mul (Float (f1 +. f2), simp f))
| Add (f, g) -> Add (simp f, simp g)
(* 0 - x -> - x *)
| Sub (Float 0., f) -> simp (Mul (Float (-1.), simp f))
(* x - 0 -> x *)
| Sub (f, Float 0.) -> simp f
(* f1 - f2 -> calcul (f1 - f2) *)
| Sub (Float f1, Float f2) -> Float (f1 -. f2)
(* f1 * x + x -> (f1 + 1) * x *)
| Sub (f, g) when f = g -> Float 0.
| Sub (f, g) -> Sub (simp f, simp g)
(* 0 / x -> 0 *)
| Div (Float 0., f) -> Float 0.
(* x / 1 -> x *)
| Div (f, Float 1.) -> simp f
(* f1 / f2 -> calcul (f1 / f2) *)
| Div (Float f1, Float f2) -> Float (f1 /. f2)
(* x / x -> 1 *)
| Div (f, g) when f = g -> Float 1.
| Div (f, g) -> Div (simp f, simp g)
(* 1 * x -> x *)
| Mul (Float 1., f) -> simp f
(* x * 1 -> x *)
| Mul (f, Float 1.) -> simp f
(* 0 * x -> 0 *)
| Mul (Float 0., f) -> Float 0.
(* x * 0 -> 0 *)
| Mul (f, Float 0.) -> Float 0.
(* f1 * f2 -> calcul (f1 * f2) *)
| Mul (Float f1, Float f2) -> Float (f1 *. f2)
(* x * x -> x ^ 2 *)
| Mul (f, g) when f = g -> simp (Puis (simp f, Float 2.))
(* x ^ a * x -> x ^ (a + 1) *)
| Mul (Puis (f, g), h) when f = h -> Puis (simp f, simp (Add (simp g, Float 1.)))
(* (f1 * x) * f2 -> (f1 * f2) * x *)
| Mul (Mul (Float f1, f), Float f2) -> simp (Mul (Float (f1 *. f2), simp f))
(* f1 * (f2 * x) -> (f1 * f2) * x *)
| Mul (Float f1, Mul (Float f2, f)) -> simp (Mul (Float (f1 *. f2), simp f))
(* (x * f1) * f2 -> (f1 * f2) * x *)
| Mul (Mul (f, Float f1), Float f2) -> simp (Mul (Float (f1 *. f2), simp f))
(* f1 * (x * f2) -> (f1 * f2) * x *)
| Mul (Float f1, Mul (f, Float f2)) -> simp (Mul (Float (f1 *. f2), simp f))
| Mul (f, g) -> Mul (simp f, simp g)
(* x ^ 0 -> 1 *)
| Puis (f, Float 0.) -> Float 1.
(* 0 ^ x -> 0 *)
| Puis (Float 0., f) -> Float 0.
(* x ^ 1 -> x *)
| Puis (f, Float 1.) -> simp f
| Puis (f, g) -> Puis (simp f, simp g)
| Ln f -> Ln (simp f)
| Cos f -> Cos (simp f)
| Sin f -> Sin (simp f)
| Sqrt f -> Sqrt (simp f)
| Exp f -> Exp (simp f)
Here is my problem :
For simple function as x*x + x*x, this function works.
But if I enter the function : 2 + x*x - x*x, there is no simplification done. The result is : 2 + x^2 - x^2
I have no idea how I can fix this problem, I'm on it since 3 days.
I hope everything is clear, and someone can give me some tips !
Have a great day !
The problem is in two folds:
If you draw out the tree, you will see that subtree is not equal.
You do it in the top-down manner. Normally, a simplification should be done bottom up( from higher to lower precedence e.g. 2+x*x+x*x ==> 2+x^2+x^2 ==> 2+2x^2 )
Your equation is of this tree:
- : formel =
Sub (Add (Float 2., Mul (Var "x", Var "x")), Mul (Var "x", Var "x"))
Let's follows the execution sequences:
it matches Sub (f, g) -> Sub (simp f, simp g)
with
f = Add (Float 2., Mul (Var "x", Var "x"))
g = Mul (Var "x", Var "x")
from (1) it executes simp f, hence matches Add (f, g) -> Add (simp f, simp g)
2.1. it matches Float(2.) with Float f -> Float f
2.2. it matches Mul(Var("x"),Var("x")) with Mul (f, g) when f = g -> simp (Puis (simp f, Float 2.))
it continues on simp g, hence matches Mul (f, g) when f = g -> simp (Puis (simp f, Float 2.))
That's why you got the result of:
Sub (Add (Float 2., Puis (Var "x", Float 2.)), Puis (Var "x", Float 2.))
(2 + x^2 - x^2)
because the left(2 + x^2) and right(x^2) subtrees aren't equal.
To solve problem (1)
One idea is to add commutative property of addition rules and transform it to a list of same precedences. For example,
Sub(f,Add(g,h)) -> [Plus(f),Minus(g),Minus(h)]
with this you can identify the same subtrees and eliminate them.
To solve problem (2)
You need to simplify based on the precedence of operators, e.g. x*x becomes x^2 before x+x is simplified to 2x. This can be done by altering to code to run parsing multiple times. Each time that subtree has changed, rerun the simplification on the upper tree.
Another idea is to archive it through Unification & substitution technique. I haven't thought it through. But it quite convincing that's doable.

Why the .obj format has one empty face coordinate?

I followed this great tutorial on how to prepare an .obj file parser and I got lost in the end and I don't know what to do!
I Made some very simple model in Blender and saved it just like it is said in the tutorial. According to that, I should have 3 faces coordinates like this:
f 5/1/1 1/2/1 4/3/1
f 5/1/1 4/3/1 8/4/1
f 3/5/2 7/6/2 8/7/2
f 3/5/2 8/7/2 4/8/2
f 2/9/3 6/10/3 3/5/3
f 6/10/4 7/6/4 3/5/4
f 1/2/5 5/1/5 2/9/5
f 5/1/6 6/10/6 2/9/6
f 5/1/7 8/11/7 6/10/7
f 8/11/7 7/12/7 6/10/7
f 1/2/8 2/9/8 3/13/8
f 1/2/8 3/13/8 4/14/8
In my case, I have only two, and the middle one is empty:
f 1//1 2//1 4//1
f 5//2 8//2 7//2
f 1//3 5//3 2//3
f 2//4 6//4 7//4
f 3//5 7//5 8//5
f 5//6 1//6 4//6
f 8//7 5//7 4//7
f 6//8 5//8 7//8
f 2//9 3//9 4//9
f 5//10 6//10 2//10
f 3//11 2//11 7//11
f 4//5 3//5 8//5
I'm surely doing something wrong, but I have no idea what is that.
It's allowed in OBJ file format to simply omit texture attribute. Thus, f 1//1 2//1 3//1 is a valid triangle, just only with positions and normals. You should change your parser to accept that (which shouldn't be very hard).
Wikipedia article about OBJ explains that rather well:
Vertex/normal
As texture coordinates are optional, one can define geometry without them, but one must put two slashes after the vertex index before putting the normal index:
f v1//vn1 v2//vn2 v3//vn3
Also keep in mind that you don't have to specify normals either, and a face can look like:
f 1/1 2/2 3/3

Whitespaces in scraping results (python)

I'm trying to scrape a website with python2.7 and beautifulsoup4. The code I'm using works on one machine, on the other, I get the resulting 'soup' with three whitespaces added between the letters. I get something like the following (both in terminal as in eclipse/pydev. Any idea what's causing this?
i f ( w i n d o w . D o m L o a d e d )
{
D o m L o a d e d . l o a d ( f u n c t i o n ( ) { b a n n e r S y n c ( ' t b ' ) ; } ) ;
d o c u m e n t . w r i t e ( ' d i v i d = " d o m L o a d e d " s t y l e = " d i s p l a y : n o n e " > \ / d i v > ' ) ;
}
/ s c r i p t >
! - - S e r v e r : P h o b o s , S e r v e r t i m e : 0 , 0 9 2 7 s ( C : 0 , 0 5 2 0 ; Q : 7 ; 0 , 0 0 2 2 ; E : 5 2 ; 0 , 0 3 1 1 s , M : 3 ; 0 , 0 0 1 1 s , A : 0 ; 0 , 0 0 0 0 s ) , M e m : 1 2 3 0 1 K B , E n g i n e s : ( S ) p h o b o s ( 5 2 ) - - >
/ b o d y >
/ h t m l >
It's very possible that two machines have installed different HTML parser libraries, please check this link. As you know, different parsers may have different parse result, esp. for those ill-formed HTML.

Raphael JS- drag along path

I am using raphael js and have a shape moving along a path when I click "run" button. How can I also make the shape draggable so that user has option of dragging or clicking run?
Thanks. Here's my code:
Raphael("holder", 500,500, function () {
var r = this,
p = r.path ('M 215.2 448 L 215.2 405.2 L 189.8 401.5 L 161.8 393.5 L 134.3 380.8 L 112.1 363.9 L 90.9 345.4 L 73.4 321.6 L 63.9 304.6 L 56 286.1 L 47 251.7 L 47 213.1 L 49.6 196.7 L 54.4 174.5 L 58.6 159.1 L 68.2 140.6 L 78.2 123.7 L 90.9 107.8 L 103.6 95.1 L 120.5 85 L 133.2 74.5 L 154.4 63.4 L 170.8 56.5 L 191.4 50.7 L 210 47.5 L 232.7 48 L 252.3 50.7 L 269.7 55.4 L 287.2 60.2 L 306.2 70.2 L 320.5 79.8 L 338.5 93 L 351.8 105.2 L 364.4 121 L 375.6 135.3 L 385.6 154.4 L 391.4 170.8 L 396.2 188.8 L 400.4 204.6 L 400.4 223.1 L 400.4 241.1 L 396.2 263.4 L 392.5 280.8 L 384.6 299.3 L 376.1 315.7 L 363.9 333.2 L 352.3 348 L 338 364.4 L 321.1 375.5 L 296.2 387.7 L 268.7 398.8 L 268.7 378.7 L 289.3 370.2 L 298.8 364.9 L 314.7 355.4 L 328.5 343.8 L 340.6 332.7 L 353.3 318.9 L 361.8 303.6 L 370.8 286.1 L 375 271.8 L 379.8 253.8 L 381.4 238 L 381.4 218.4 L 378.2 190.9 L 372.4 175 L 365.5 156.5 L 359.2 144.8 L 347.5 129.5 L 336.4 117.9 L 323.2 103.6 L 311 95.1 L 294.6 86.1 L 279.3 77.6 L 260.7 72.4 L 245.4 69.2 L 227.4 67.1 L 211 68.1 L 192 70.8 L 176.1 75 L 157.6 81.9 L 144.3 89.8 L 129.5 99.3 L 115.8 109.9 L 102.5 124.2 L 92.5 137.4 L 82.4 154.4 L 76.6 168.1 L 70.3 183.5 L 66.6 200.4 L 65.5 218.4 L 65 232.7 L 68.2 251.7 L 70.3 266.5 L 74 281.3 L 80.9 297.2 L 90.4 313.1 L 98.3 326.3 L 111 339.5 L 118.9 347 L 132.7 356.5 L 146.5 364.9 L 162.9 373.4 L 178.2 378.7 L 189.8 382.4 L 214.2 386.1 L 213.7 292.5 L 201.5 289.3 L 191.4 283.5 L 175.6 269.7 L 164.4 254.9 L 158.1 237.4 L 158.1 219.4 L 163.4 200.4 L 171.9 185 L 183.5 175 L 195.1 167.6 L 210 162.8 L 227.4 162.3 L 241.7 164.9 L 253.9 170.2 L 267.1 179.8 L 278.7 195.1 L 285.6 213.6 L 286.7 235.3 L 283 252.8 L 272.4 267.6 L 258.6 280.3 L 248.6 287.2 L 249.1 307.8 L 267.1 299.3 L 279.8 287.7 L 294.1 272.4 L 299.9 261.8 L 305.2 243.8 L 307.3 226.2 L 306.2 212 L 301 193.5 L 292 178.7 L 281.4 166.5 L 268.2 154.9 L 253.9 148 L 235.3 142.2 L 223.7 141.1 L 206.2 143.8 L 193 147.5 L 175.6 155.4 L 165 163.9 L 154.4 178.2 L 145.9 190.9 L 142.2 209.4 L 139.1 220 L 140.6 238.5 L 142.8 248 L 149.6 267.1 L 158.1 277.1 L 169.2 291.4 L 183 299.9 L 195.7 307.3 L 194.1 364.4 L 172.4 358.1 L 157 350.7 L 141.2 337.4 L 126.4 326.3 L 112.6 310.4 L 102.5 298.3 L 94.6 279.8 L 87.7 262.8 L 84 242.2 L 83 226.2 L 85.1 208.3 L 88.3 189.8 L 95.7 170.2 L 103.1 153.8 L 115.8 137.4 L 129.5 121.6 L 146.5 108.9 L 165 99.9 L 184.6 91.9 L 201.5 87.7 L 222.6 86.6 L 241.7 87.7 L 261.8 91.4 L 278.7 97.2 L 298.8 108.9 L 313.7 119.4 L 330.1 136.9 L 341.7 152.2 L 350.7 171.3 L 357.6 187.2 L 362.3 204.1 L 362.9 221.6 L 361.3 242.2 L 357.6 261.8 L 350.2 282.9 L 343.8 297.7 L 332.7 312.6 L 312.6 330 L 299.9 343.3 L 285.6 351.2 L 262.9 361.8 L 250.7 363.9 L 249.6 421.6 L 268.7 419.4 L 287.2 413.6 L 306.2 405.2 L 326.4 393.5 L 341.7 382.9 L 353.9 371.8 L 366 360.2 L 387.7 333.7 L 396.2 318.9 L 403.6 302 L 410 285.6 L 416.8 253.8 L 419.5 226.2 L 418.4 196.7 L 414.2 180.8 L 409.4 162.3 L 401 145.9 L 392.5 129.5 L 374 100.9 L 362.3 87.7 L 348 76.1 L 336.9 65.5 L 321.1 55.4 L 304.7 48 L 289.3 40.6 L 272.9 35.3 L 254.4 31.1 L 236.9 27.9 L 218.4 27.9 L 202.5 30.6 L 183 33.2 L 168.2 35.8 L 149.1 43.2 L 134.8 50.7 L 117.4 61.2 L 107.3 69.2 L 93 79.8 L 79.8 93 L 67.6 106.2 L 56.5 121.6 L 47 138 L 40.6 151.2 L 35.9 168.1 L 31.1 184.5 L 28.5 199.3 L 28.5 216.3 L 28.5 235.3 L 28.5 251.2 L 31.6 269.2 L 34.3 284 L 40.1 299.3 L 48 315.7 L 57 333.2 L 66 345.4 L 78.2 360.7 L 90.4 373.4 L 104.7 384 L 118.4 393.5 L 135.3 403 L 150.7 409.4 L 169.2 416.3 L 186.1 420.5 L 195.7 421.6 L 196.7 441.1 L 178.2 438.5 L 158.6 432.7 L 140.1 426.3 L 121.6 416.8 L 105.7 407.8 L 90.4 394.6 L 76.6 384 L 62.3 370.2 L 50.7 354.4 L 39.1 339.5 L 31.1 323.7 L 23.2 304.1 L 17.4 288.2 L 12.6 268.1 L 9.4 250.7 L 9.4 229 L 9.4 213.1 L 9.4 194 L 12.6 177.6 L 17.9 157.5 L 23.7 142.2 L 32.2 125.3 L 41.7 108.9 L 56.5 90.9 L 68.2 78.7 L 84 63.9 L 96.7 52.2 L 113.7 42.2 L 127.4 34.3 L 146.5 25.3 L 163.9 19.4 L 183 14.7 L 199.9 11.5 L 222.6 11.5 L 241.7 11.5 L 262.9 15.2 L 278.7 19.4 L 299.9 25.8 L 314.7 33.7 L 334.8 42.2 L 348 51.7 L 366 66.5 L 378.2 78.2 L 389.8 90.3 L 401.5 105.2 L 411.5 122.6 L 420.5 139.5 L 429.5 160.7 L 433.2 176.6 L 436.9 201.1 L 439.6 217.3 L 439.6 235.8 L 436.4 258.1 L 431.1 278.2 L 426.4 295.6 L 417.9 316.3 L 409.4 332.7 L 401 347 L 391.4 361.8 L 376.1 376.1 L 362.9 389.3 L 349.6 399.9 L 333.8 411.5 L 314.7 421 L 298.3 428.4 L 277.1 435.3 L 259.7 438.5 L 231.1 441.7 L 230.1 348 L 243.3 346.4 L 260.2 341.7 L 278.2 333.7 L 291.4 326.3 L 304.1 314.7 L 317.9 301.5 L 329 286.1 L 337.5 269.2 L 342.8 252.8 L 344.3 235.3 L 343.3 220 L 341.2 201.5 L 339.6 190.3 L 332.7 175 L 325.3 159.7 L 313.1 144.8 L 301 132.7 L 286.1 123.1 L 272.4 114.7 L 254.4 109.4 L 239.6 106.2 L 220 105.2 L 205.2 105.7 L 187.7 110.4 L 168.7 117.3 L 153.9 127.4 L 138.5 137.4 L 127.9 151.7 L 118.4 164.4 L 110.5 180.3 L 105.2 197.2 L 102.5 214.7 L 101 226.2 L 103.1 242.7 L 105.7 258.6 L 111.5 275.5 L 117.4 287.7 L 128.5 302.5 L 138.5 315.7 L 154.9 329 L 164.4 333.2 L 174.5 336.9 L 176.6 316.8 L 165.4 312.4 L 153.3 300.4 L 141.2 288.2 L 132.2 270.2 L 124.2 255.9 L 122.1 238 L 120.5 217.9 L 125.8 198.3 L 130.6 181.3 L 143.8 162.8 L 154.4 149.6 L 168.7 138 L 186.1 131.6 L 207.8 126.3 L 222.9 124.2 L 245.4 127.4 L 261.8 131.1 L 280.9 142.2 L 295.7 153.8 L 308.4 172.9 L 317.4 190.9 L 324.2 214.1 L 324.8 232.1 L 321.6 253.3 L 316.3 271.3 L 302.5 289.8 L 288.8 302.5 L 274 315.7 L 256 322.6 L 231.6 329.5 L 225.8 222.6 L 215.2').attr({stroke: "#fff", opacity: .0, "stroke-width": 10}),
len = p.getTotalLength(),
e = r.ellipse(0, 0, 6, 6).attr({stroke: "none", fill: "#fef506"}).onAnimation(function () {
var t = this.attr("transform");
over.attr({path: "M238,376L" + t[0][1] + "," + t[0][2] + "z"});
});
r.circle(516, 248, 5).attr({stroke: "none", fill: "#", opacity: 0}).click(function () {
e.attr({rx: 5, ry: 3}).animateAlong(p, 4000, true, function () {
e.attr({rx: 4, ry: 4});
});
});
r.customAttributes.along = function (v) {
var point = p.getPointAtLength(v * len);
return {
transform: "t" + [point.x, point.y] + "r" + point.alpha
};
};
e.attr({along: 0});
var rotateAlongThePath = true;
run=document.getElementById('run'),
run.onclick= function() {
e.animate({along:3},2000000, function () {
e.attr({along: 0});
e.animate(anim.delay(500));
setTimeout(run);
});
}
run();
});