diff --git a/src/librt/primitives/ell/ell.c b/src/librt/primitives/ell/ell.c
index 6a02e6b98f..83fe7a4dc8 100644
--- a/src/librt/primitives/ell/ell.c
+++ b/src/librt/primitives/ell/ell.c
@@ -1342,6 +1342,30 @@ rt_ell_export4(struct bu_external *ep, const struct rt_db_internal *ip, double l
     return 0;
 }
 
+int
+rt_ell_mat(struct rt_db_internal *rop, const mat_t mat, const struct rt_db_internal *ip)
+{
+    if (!rop || !ip || !mat)
+	return BRLCAD_OK;
+
+    struct rt_ell_internal *tip = (struct rt_ell_internal *)ip->idb_ptr;
+    RT_ELL_CK_MAGIC(tip);
+    struct rt_ell_internal *top = (struct rt_ell_internal *)rop->idb_ptr;
+    RT_ELL_CK_MAGIC(top);
+
+    vect_t v, a, b, c;
+    VMOVE(v, tip->v);
+    VMOVE(a, tip->a);
+    VMOVE(b, tip->b);
+    VMOVE(c, tip->c);
+
+    MAT4X3PNT(top->v, mat, v);
+    MAT4X3VEC(top->a, mat, a);
+    MAT4X3VEC(top->b, mat, b);
+    MAT4X3VEC(top->c, mat, c);
+
+    return BRLCAD_OK;
+}
 
 /**
  * Import an ellipsoid/sphere from the database format to the internal
@@ -1372,14 +1396,14 @@ rt_ell_import5(struct rt_db_internal *ip, const struct bu_external *ep, register
     /* Convert from database (network) to internal (host) format */
     bu_cv_ntohd((unsigned char *)vec, ep->ext_buf, ELEMENTS_PER_VECT*4);
 
+    VMOVE(eip->v, &vec[0*ELEMENTS_PER_VECT]);
+    VMOVE(eip->a, &vec[1*ELEMENTS_PER_VECT]);
+    VMOVE(eip->b, &vec[2*ELEMENTS_PER_VECT]);
+    VMOVE(eip->c, &vec[3*ELEMENTS_PER_VECT]);
+
     /* Apply modeling transformations */
     if (mat == NULL) mat = bn_mat_identity;
-    MAT4X3PNT(eip->v, mat, &vec[0*ELEMENTS_PER_VECT]);
-    MAT4X3VEC(eip->a, mat, &vec[1*ELEMENTS_PER_VECT]);
-    MAT4X3VEC(eip->b, mat, &vec[2*ELEMENTS_PER_VECT]);
-    MAT4X3VEC(eip->c, mat, &vec[3*ELEMENTS_PER_VECT]);
-
-    return 0;		/* OK */
+    return rt_ell_mat(ip, mat, ip);
 }
 
 
diff --git a/src/librt/primitives/table.cpp b/src/librt/primitives/table.cpp
index 56f48de58d..f7bb010150 100644
--- a/src/librt/primitives/table.cpp
+++ b/src/librt/primitives/table.cpp
@@ -262,7 +262,7 @@ const struct rt_functab OBJ[] = {
 	NULL, /* serialize */
 	RTFUNCTAB_FUNC_LABELS_CAST(rt_tor_labels), /* label */
 	RTFUNCTAB_FUNC_KEYPOINT_CAST(rt_tor_keypoint), /* keypoint */
-	NULL, /* mat */
+	RTFUNCTAB_FUNC_MAT_CAST(rt_tor_mat),
 	NULL  /* perturb */
     },
 
@@ -312,7 +312,7 @@ const struct rt_functab OBJ[] = {
 	NULL, /* serialize */
 	RTFUNCTAB_FUNC_LABELS_CAST(rt_tgc_labels), /* label */
 	RTFUNCTAB_FUNC_KEYPOINT_CAST(rt_tgc_keypoint), /* keypoint */
-	NULL, /* mat */
+	RTFUNCTAB_FUNC_MAT_CAST(rt_tgc_mat),
 	RTFUNCTAB_FUNC_PERTURB_CAST(rt_tgc_perturb) /* perturb */
     },
 
@@ -362,7 +362,7 @@ const struct rt_functab OBJ[] = {
 	NULL, /* serialize */
 	RTFUNCTAB_FUNC_LABELS_CAST(rt_ell_labels), /* label */
 	RTFUNCTAB_FUNC_KEYPOINT_CAST(rt_ell_keypoint), /* keypoint */
-	NULL, /* mat */
+	RTFUNCTAB_FUNC_MAT_CAST(rt_ell_mat),
 	NULL  /* perturb */
     },
 
diff --git a/src/librt/primitives/tgc/tgc.c b/src/librt/primitives/tgc/tgc.c
index 99fdec2968..d13ac15967 100644
--- a/src/librt/primitives/tgc/tgc.c
+++ b/src/librt/primitives/tgc/tgc.c
@@ -1674,6 +1674,35 @@ rt_tgc_export4(struct bu_external *ep, const struct rt_db_internal *ip, double l
     return 0;
 }
 
+int
+rt_tgc_mat(struct rt_db_internal *rop, const mat_t mat, const struct rt_db_internal *ip)
+{
+    if (!rop || !ip || !mat)
+	return BRLCAD_OK;
+
+    struct rt_tgc_internal *tip = (struct rt_tgc_internal *)ip->idb_ptr;
+    RT_TGC_CK_MAGIC(tip);
+    struct rt_tgc_internal *top = (struct rt_tgc_internal *)rop->idb_ptr;
+    RT_TGC_CK_MAGIC(top);
+
+    vect_t v, h, a, b, c, d;
+    VMOVE(v, tip->v);
+    VMOVE(h, tip->h);
+    VMOVE(a, tip->a);
+    VMOVE(b, tip->b);
+    VMOVE(c, tip->c);
+    VMOVE(d, tip->d);
+
+    MAT4X3PNT(top->v, mat, v);
+    MAT4X3VEC(top->h, mat, h);
+    MAT4X3VEC(top->a, mat, a);
+    MAT4X3VEC(top->b, mat, b);
+    MAT4X3VEC(top->c, mat, c);
+    MAT4X3VEC(top->d, mat, d);
+
+    return BRLCAD_OK;
+}
+
 
 /**
  * Import a TGC from the database format to the internal format.
@@ -1704,14 +1733,16 @@ rt_tgc_import5(struct rt_db_internal *ip, const struct bu_external *ep, register
     /* Convert from database (network) to internal (host) format */
     bu_cv_ntohd((unsigned char *)vec, ep->ext_buf, ELEMENTS_PER_VECT*6);
 
+    VMOVE(tip->v, &vec[0*ELEMENTS_PER_VECT]);
+    VMOVE(tip->h, &vec[1*ELEMENTS_PER_VECT]);
+    VMOVE(tip->a, &vec[2*ELEMENTS_PER_VECT]);
+    VMOVE(tip->b, &vec[3*ELEMENTS_PER_VECT]);
+    VMOVE(tip->c, &vec[4*ELEMENTS_PER_VECT]);
+    VMOVE(tip->d, &vec[5*ELEMENTS_PER_VECT]);
+
     /* Apply modeling transformations */
     if (mat == NULL) mat = bn_mat_identity;
-    MAT4X3PNT(tip->v, mat, &vec[0*ELEMENTS_PER_VECT]);
-    MAT4X3VEC(tip->h, mat, &vec[1*ELEMENTS_PER_VECT]);
-    MAT4X3VEC(tip->a, mat, &vec[2*ELEMENTS_PER_VECT]);
-    MAT4X3VEC(tip->b, mat, &vec[3*ELEMENTS_PER_VECT]);
-    MAT4X3VEC(tip->c, mat, &vec[4*ELEMENTS_PER_VECT]);
-    MAT4X3VEC(tip->d, mat, &vec[5*ELEMENTS_PER_VECT]);
+    rt_tgc_mat(ip, mat, ip);
 
     return 0;		/* OK */
 }
diff --git a/src/librt/primitives/tor/tor.c b/src/librt/primitives/tor/tor.c
index 6932e906f8..f913276f7e 100644
--- a/src/librt/primitives/tor/tor.c
+++ b/src/librt/primitives/tor/tor.c
@@ -1630,6 +1630,44 @@ rt_tor_export4(struct bu_external *ep, const struct rt_db_internal *ip, double l
     return 0;
 }
 
+int
+rt_tor_mat(struct rt_db_internal *rop, const mat_t mat, const struct rt_db_internal *ip)
+{
+    if (!rop || !ip || !mat)
+	return BRLCAD_OK;
+
+    struct rt_tor_internal *tip = (struct rt_tor_internal *)ip->idb_ptr;
+    RT_TOR_CK_MAGIC(tip);
+    struct rt_tor_internal *top = (struct rt_tor_internal *)rop->idb_ptr;
+    RT_TOR_CK_MAGIC(top);
+
+    double r_a, r_h;
+    vect_t v, h;
+    VMOVE(v, tip->v);
+    VMOVE(h, tip->h);
+    r_a = tip->r_a;
+    r_h = tip->r_h;
+
+    /* Apply modeling transformations */
+    MAT4X3PNT(top->v, mat, v);
+    MAT4X3VEC(top->h, mat, h);
+    VUNITIZE(top->h);			/* just to be sure */
+
+    top->r_a = r_a / mat[15];
+    top->r_h = r_h / mat[15];
+
+    /* Prepare the extra information */
+    top->r_b = top->r_a;
+
+    /* Calculate two mutually perpendicular vectors, perpendicular to N */
+    bn_vec_ortho(top->a, top->h);	 /* a has unit length */
+    VCROSS(top->b, top->h, top->a); /* |A| = |H| = 1, so |B|=1 */
+
+    VSCALE(top->a, top->a, top->r_a);
+    VSCALE(top->b, top->b, top->r_b);
+
+    return BRLCAD_OK;
+}
 
 /**
  * Taken from the database record:
@@ -1678,23 +1716,15 @@ rt_tor_import5(struct rt_db_internal *ip, const struct bu_external *ep, register
 
     bu_cv_ntohd((unsigned char *)&rec, ep->ext_buf, 2*3+2);
 
-    /* Apply modeling transformations */
-    MAT4X3PNT(tip->v, mat, rec.v);
-    MAT4X3VEC(tip->h, mat, rec.h);
-    VUNITIZE(tip->h);			/* just to be sure */
+    /* Set up initial data */
+    VMOVE(tip->v, rec.v);
+    VMOVE(tip->h, rec.h);
+    tip->r_a = rec.ra;
+    tip->r_h = rec.rh;
 
-    tip->r_a = rec.ra / mat[15];
-    tip->r_h = rec.rh / mat[15];
-
-    /* Prepare the extra information */
-    tip->r_b = tip->r_a;
-
-    /* Calculate two mutually perpendicular vectors, perpendicular to N */
-    bn_vec_ortho(tip->a, tip->h);	/* a has unit length */
-    VCROSS(tip->b, tip->h, tip->a);	/* |A| = |H| = 1, so |B|=1 */
+    /* Apply modeling transformations */
+    rt_tor_mat(ip, mat, ip);
 
-    VSCALE(tip->a, tip->a, tip->r_a);
-    VSCALE(tip->b, tip->b, tip->r_b);
     return 0;
 }