Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 63776)
+++ CMakeLists.txt	(working copy)
@@ -39,6 +39,8 @@
 set (ciTests_SRC
 	halfspace.cpp
 	primitives.cpp
+	sphere.cpp
+	cone.cpp
 )
 
 add_executable(tester_ci_primitives ${ciTests_SRC})
Index: cone.cpp
===================================================================
--- cone.cpp	(revision 0)
+++ cone.cpp	(working copy)
@@ -0,0 +1,296 @@
+/*                      C O N E . C P P
+ * BRL-CAD
+ *
+ * Copyright (c) 2014 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file Cone.cpp
+ *
+ *  BRL-CAD core C++ interface:
+ *      truncated general cone (ID_TGC) database object implementation
+ *
+ *  Origin -
+ *      TNO (Netherlands)
+ *      IABG mbH (Germany)
+ */
+
+#include <brlcad/Cone.h>
+using namespace BRLCAD;
+
+/* A function to compare two Vector3Ds */
+static bool  cmp(Vector3D a, Vector3D b)
+{
+	if(a.coordinates[0]==b.coordinates[0] && a.coordinates[1]==b.coordinates[1] && a.coordinates[2]==b.coordinates[2]) 
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's BasePoint function */
+static int testConeBasePoint(BRLCAD::Cone c, Vector3D expected)
+{
+	return cmp(c.BasePoint(),expected);
+}
+
+/* Tests Cone's SetBasePoint function */
+static int testConeSetBasePoint(BRLCAD::Cone c, Vector3D bp)
+{
+	c.SetBasePoint(bp);
+	return cmp(c.BasePoint(),bp);
+}
+
+/* Tests Cone's Height function */
+static int testConeHeight(BRLCAD::Cone c, Vector3D expected)
+{
+	return cmp(c.Height(),expected);
+}
+
+/* Tests Cone's SetHeight function */
+static int testConeSetHeight(BRLCAD::Cone c, Vector3D h)
+{
+	c.SetHeight(h);
+	return cmp(c.Height(),h);
+}
+
+/* Tests Cone's SemiPrincipalAxis function */
+static int testConeSemiPrincipalAxis(BRLCAD::Cone c, Vector3D expected, size_t index)
+{
+	if(cmp(c.SemiPrincipalAxis(),expected)==0 && c.index==index) 
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's SetSemiPrincipalAxis function */
+static int testConeSetSemiPrincipalAxis(BRLCAD::Cone c, size_t index, Vector3D spa)
+{
+	c.SetSemiPrincipalAxis(index,spa);
+	if(cmp(c.SemiPrincipalAxis(),expected)==0 && c.index==index) 
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Set of a right elliptical cylinder (rec) */
+static int testConeSetREC(BRLCAD::Cone rec, Vector3D bp, Vector3D h, Vector3D spaA, Vector3D spaB)
+{
+	rec.Set(bp,h,spaA,spaB);
+	if(cmp(bp,rec.BasePoint())==0 && cmp(h,rec.Height())==0 && cmp(spaA,rec.SemiPrincipalAxisA)==0 && cmp(spaB,rec.SemiPrincipalAxisB)==0)
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Set of a truncated general cone (tgc) */
+static int testConeSetTGC(BRLCAD::Cone tgc, Vector3D bp, Vector3D h, Vector3D spaA, Vector3D spaB, double CtoA, double BtoD)
+{
+	tgc.Set(bp,h,spaA,spaB,CtoA,BtoD);
+	if(cmp(bp,tgc.Basepoint())==0 && cmp(h,tgc.Height())==0 && cmp(spaA,tgc.SemiPrincipalAxisA)==0 && cmp(spaB,tgc.SemiPrincipalAxisB)==0 && CtoA==tgc.ratioCtoA && BtoD==ratioBtoD)
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Set of a truncated elliptical cone (tec) */
+static int testConeSetTEC(BRLCAD::Cone tec, Vector3D bp, Vector3D h, Vector3D spaA, Vector3D spaB, double scale)
+{
+	tec.Set(bp,h,spaA,spaB,scale);
+	if(cmp(bp,tec.BasePoint())==0 && cmp(h,tec.BasePoint())==0 && cmp(spaA,tec.SemiPrincipalAxisA)==0 && cmp(spaB,tec.SemiPrincipalAxisB)==0 && scale==tec.scale)
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Set of a truncated right cone (trc) */
+static int testConeSetTRC(BRLCAD::Cone trc, Vector3D bp, Vector3D h, double radiusBase, double radiusTop)
+{
+	trc.Set(bp,h,radiusBase,radiusTop);
+	if(cmp(bp,trc.BasePoint())==0 && cmp(h,trc.Height())==0 && radiusBase==trc.radiusBase && radiusTop==trc.radiusTop)
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Set of a right circular cylinder (rcc) */
+static int testConeSetRCC(BRLCAD::Cone rcc, Vector3D bp, Vector3D h, double radius)
+{
+	rcc.Set(bp,h,radius);
+	if(cmp(bp,rcc.BasePoint())==0 && cmp(h,rcc.Height())==0 && radius==trc.radius)
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Clone of a right elliptical cylinder (rec) */
+static int testConeCloneREC(BRLCAD::Cone rec)
+{
+	BRLCAD::Cone c2;
+	c2=rec.Clone();
+	if(cmp(c2.BasePoint(),rec.BasePoint())==0 && cmp(c2.Height(),rec.Height())==0 && cmp(c2.SemiPrincipalAxisA,rec.SemiPrincipalAxisA)==0 && cmp(c2.SemiPrincipalAxisB,rec.SemiPrincipalAxisB)==0)
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Clone of a truncated general cone (tgc) */
+static int testConeCloneTGC(BRLCAD::Cone tgc)
+{
+	BRLCAD::Cone c2;
+    c2=tgc.Clone(); 
+    if(cmp(c2.BasePoint(),tgc.Basepoint())==0 && cmp(c2.Height(),tgc.Height())==0 && cmp(c2.SemiPrincipalAxisA,tgc.SemiPrincipalAxisA)==0 && cmp(c2.SemiPrincipalAxisB,tgc.SemiPrincipalAxisB)==0 && c2.ratioCtoA==tgc.ratioCtoA && c2.ratioBtoD==ratioBtoD)
+    	return 0;
+	return 1;
+}
+
+/* Tests Cone's Clone of a truncated elliptical cone (tec) */
+static int testConeCloneTEC(BRLCAD::Cone tec)
+{
+	BRLCAD::Cone c2;
+	c2=tec.Clone();
+	if(cmp(c2.BasePoint(),tec.BasePoint())==0 && cmp(c2.Height(),tec.BasePoint())==0 && cmp(c2.SemiPrincipalAxisA,tec.SemiPrincipalAxisA)==0 && cmp(c2.SemiPrincipalAxisB,tec.SemiPrincipalAxisB)==0 && c2.scale==tec.scale) 
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Clone of a truncated right cone (trc) */
+static int testConeCloneTRC(BRLCAD::Cone trc)
+{
+	BRLCAD::Cone c2;
+	c2=trc.Clone();
+	if(cmp(c2.BasePoint(),trc.BasePoint())==0 && cmp(c2.Height(),trc.Height())==0 && c2.radiusBase==trc.radiusBase && c2.radiusTop==trc.radiusTop) 
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Clone of a right circular cylinder (rcc) */
+static int testConeCloneRCC(BRLCAD::Cone rcc)
+{
+	BRLCAD::Cone c2;
+	c2=rcc.Clone();
+	if(cmp(c2.BasePoint(),rcc.BasePoint())==0 && cmp(c2.Height(),rcc.Height())==0 && c2.radius==trc.radius)
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's ClassName function */
+static int testConeClassName(BRLCAD::Cone c) 
+{
+	if(strcmp(c.ClassName(),"Cone")==0) 
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's Type function */
+static int testConeType(BRLCAD::Cone c)
+{
+	if(strcmp(c.Type(),c.ClassName())==0) 
+		return 0;
+	return 1;
+}
+
+/* Tests Cone's IsValid function */
+static int testConeIsValid(BRLCAD::Cone c) 
+{
+	if(c.IsValid()==true) 
+		return 0;
+	return 1;
+}
+/* We now run all the tests */
+void test_cone(BRLCAD::Database& database)
+{	
+
+	/* Initialize a Cone to test on, with BasePoint,Height and Radius */
+	BRLCAD::Cone c;
+	c.Set(Vector3D(1.0,1.0,1.0),Vector3D(1.0,1.0,1.0),10);
+
+	/* Initialize a boolean to see if one or more of the tests failed */
+	bool ok=0;
+	
+	/* Runs all the tests */
+	if( testConeIsValid(c)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : IsValid()";
+	}
+	if( testConeType(c)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Type()";
+	}
+	if( testConeClassName(c)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : ClassName()";
+	}
+	if( testConeBasePoint(c,Vector3D(1.0,1.0,1.0))==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : BasePoint()";
+	}
+	if( testConeHeight(c,Vector3D(1.0,1.0,1.0))==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Height()";
+	}
+	c.SetSemiPrincipalAxis(1,Vector3D(1.0,1.0,1.0));
+	if( testConeSemiPrincipalAxis(c,Vector3D(1.0,1.0,1.0),1)==1 )
+	{
+		ok=1;
+		std::cout<<"Test failed at function : SemiPrincipalAxis()";
+	}
+	if( testConeSetBasePoint(c, Vector3D(2.0,2.0,2.0)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : SetBasePoint()";
+	}
+	if( testConeSetHeight(c, Vector3D(2.0,2.0,2.0)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : SetHeight()";
+	}
+	if( testConeSetSemiPrincipalAxis(c, 2, Vector3D(2.0,2.0,2.0)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : SetSemiPrincipalAxis()";
+	}
+	if( testConeSetREC(c, Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0))==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Set(), with a right elliptical cylinder";
+	} 
+	if( testConeSetTGC(c, Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), 2, 4)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Set(), with a truncated general cone";
+	}
+	if( testConeSetTEC(c, Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), 2)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Set(), with a truncated elliptical cone";
+	}
+	if( testConeSetTRC(c, Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), 4, 2)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Set(), with a truncated right cone";
+	}
+	if( testConeSetRCC(c, Vector3D(1.0,1.0,1.0), Vector3D(1.0,1.0,1.0), 4)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Set(), with a right circular cylinder";
+	}
+	if( testConeCloneREC(c)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Clone(), with a right elliptical cylinder";
+	}
+	if( testConeCloneTGC(c)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Clone(), with a truncated general cone";
+	}
+	if( testConeCloneTEC(c)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Clone(), with a truncated elliptical cone";
+	}
+	if( testConeCloneTRC(c)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Clone(), with a truncated right cone";
+	}
+	if( testConeCloneRCC(c)==1 ){
+		ok=1;
+		std::cout<<"Test failed at function : Clone(), with a right circular cylinder";
+	}
+
+	/* We only add the cone to the database if it failed no tests and is a valid cone */
+	if( ok==0 && c.Isvalid() ) database.add(c); 
+}
+
Index: primitives.cpp
===================================================================
--- primitives.cpp	(revision 63776)
+++ primitives.cpp	(working copy)
@@ -47,6 +47,8 @@
 
 	    if (database.Load(argv[1])) {
 		test_halfspace(database);
+		test_sphere(database);
+	        test_cone(database);
 	    } else {
 		std::cout << "Could not load file: " << argv[1] << std::endln;
 		ret = 2;
Index: primitives.h
===================================================================
--- primitives.h	(revision 63776)
+++ primitives.h	(working copy)
@@ -30,6 +30,8 @@
 
 
 void test_halfspace(BRLCAD::Database& database);
+void test_sphere(BRLCAD::Database& database);
+void test_cone(BRLCAD::Database& database);
 
 
 #endif // PRIMITIVES_H
