Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (48 sloc) 1.75 KB
/*
The Edge class represents the red lines that are drawn between the articles, showing how the webscraper
got to a given article from Philosophy.
*/
class Edge{
PShape s;
float[] childCoordinates = new float[8];
float[] parentCoordinates = new float[8];
String parent;
String child;
/*
@param childComps Array of the principle components of the child article.
@param parentComps Array of the principle components of the parent article.
@param childTitle String containing the title of the child article
@ param parentTitle String containing the title of the parent article
*/
public Edge(float[] childComps, float[] parentComps, String childTitle, String parentTitle) {
this.parent = parentTitle;
this.child = childTitle;
this.childCoordinates = childComps;
this.parentCoordinates = parentComps;
}
/*
Draws a line between the child and parent articles. Also draws the titles of the child and parent.
*/
public void drawLine() {
stroke(color(250, 0, 0, 300));
strokeWeight(1);
line(childCoordinates[0], childCoordinates[1], childCoordinates[2],
parentCoordinates[0], parentCoordinates[1], parentCoordinates[2]);
textSize(50);
fill(color(250, 0, 0, 300));
pushMatrix();
translate(childCoordinates[0], childCoordinates[1]-5, childCoordinates[2]);
rotateX(cam.getRotations()[0]);
rotateY(cam.getRotations()[1]);
rotateZ(cam.getRotations()[2]);
text(child, 0, 0,0);
popMatrix();
pushMatrix();
translate(parentCoordinates[0], parentCoordinates[1]-5, parentCoordinates[2]);
rotateX(cam.getRotations()[0]);
rotateY(cam.getRotations()[1]);
rotateZ(cam.getRotations()[2]);
text(parent, 0, 0, 0);
popMatrix();
}
}
You can’t perform that action at this time.