Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/convolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ int main()
auto rgvp = v.addVisualModel (rgv);

// Demonstrate how to divide existing scale by 10:
float newGrad = hgvp->zScale.getParams(0)/10.0;
float newGrad = hgvp->zScale.get_params(0)/10.0;
// Set this in a new zscale object:
sm::scale<float> zscale;
zscale.setParams (newGrad, 0);
zscale.set_params (newGrad, 0);
// Use the un-owned pointer rgvp:
rgvp->updateZScale (zscale);

Expand Down
3 changes: 2 additions & 1 deletion examples/cray_eye.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <sm/vec>
#include <sm/vvec>
#include <sm/mat>

#include <mplot/Visual.h>
#include <mplot/ColourMap.h>
Expand Down Expand Up @@ -73,7 +74,7 @@ int main (int argc, char** argv)

auto ptype = mplot::compoundray::EyeVisual<>::projection_type::equirectangular; // mercator, equirectangular or cassini
sm::vec<> centre = { 0, 0, 0 };
sm::mat44<float> twod_tr;
sm::mat<float, 4> twod_tr;
twod_tr.translate (sm::vec<>{0,0,-0.1});
eyevm->add_spherical_projection (ptype, twod_tr, centre, psrad);
eyevm->pre_set_cone_length (4e-6f);
Expand Down
18 changes: 9 additions & 9 deletions examples/cubetrans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <iostream>

#include <sm/vec>
#include <sm/mat44>
#include <sm/mat>
#include <mplot/compoundray/Visual.h>
#include <mplot/RhomboVisual.h>
#include <mplot/VectorVisual.h>
Expand Down Expand Up @@ -56,20 +56,20 @@ int main()
Eigen::Vector3f ed1_s (d1_s[0], d1_s[1], d1_s[2]);
Eigen::Vector3f ed1_e (d1_e[0], d1_e[1], d1_e[2]);

// mat44 transformation
sm::mat44<float> m1t;
sm::mat44<float> m1tor;
sm::mat44<float> m1r;
sm::mat44<float> m1torb;
sm::mat44<float> m1t2;
// mat transformation
sm::mat<float, 4> m1t;
sm::mat<float, 4> m1tor;
sm::mat<float, 4> m1r;
sm::mat<float, 4> m1torb;
sm::mat<float, 4> m1t2;
// sequence:
m1t.translate (mv1);
m1tor.translate (-(l1 + mv1));
m1r.rotate (ra, rotang);
m1torb.translate (l1 + mv1);
m1t2.translate (m1r * mv2);
// Combine by multiplication:
sm::mat44<float> m1 = m1t2 * m1torb * m1r * m1tor * m1t;
sm::mat<float, 4> m1 = m1t2 * m1torb * m1r * m1tor * m1t;

// Eigen transformation
Eigen::Transform<float, 3, Eigen::TransformTraits::Affine> em1t;
Expand Down Expand Up @@ -120,7 +120,7 @@ int main()
* the transforms are applied.
*/

// Apply mat44
// Apply sm::mat
sm::vec<> l2 = (m1 * l1).less_one_dim();
sm::vec<> d2_s = (m1 * d1_s).less_one_dim();
sm::vec<> d2_e = (m1 * d1_e).less_one_dim();
Expand Down
30 changes: 15 additions & 15 deletions examples/cubetrans2.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Draw a cube with RhomboVisual and then make up vectors to transform with mat44s
// Draw a cube with RhomboVisual and then make up vectors to transform with sm::mat<>s

#include <iostream>

#include <sm/vec>
#include <sm/mat44>
#include <sm/mat>
#include <mplot/compoundray/Visual.h>
#include <mplot/RhomboVisual.h>
#include <mplot/VectorVisual.h>
Expand Down Expand Up @@ -46,22 +46,22 @@ int main()
sm::vec<> d_l1_s = d_l1_s_e - d_l1_s_s;
auto rotang1 = sm::mathconst<float>::pi / 2;

// mat44 transformation
sm::mat44<float> m1t;
sm::mat44<float> m1tor;
sm::mat44<float> m1r;
sm::mat44<float> m1torb;
sm::mat44<float> m1t2;
// matrix transformation
sm::mat<float, 4> m1t;
sm::mat<float, 4> m1tor;
sm::mat<float, 4> m1r;
sm::mat<float, 4> m1torb;
sm::mat<float, 4> m1t2;
// sequence:
m1t.translate (mv1);
m1tor.translate (-(l1_s + mv1));
m1r.rotate (ra, rotang1);
m1torb.translate (l1_s + mv1);
m1t2.translate (m1r * mv2);
// Combine by multiplication:
sm::mat44<float> m1 = m1t2 * m1torb * m1r * m1tor * m1t;
sm::mat<float, 4> m1 = m1t2 * m1torb * m1r * m1tor * m1t;

// Apply mat44
// Apply matrix
sm::vec<> l1_e = (m1 * l1_s).less_one_dim();
sm::vec<> d_l1_e_s = (m1 * d_l1_s_s).less_one_dim();
sm::vec<> d_l1_e_e = (m1 * d_l1_s_e).less_one_dim();
Expand Down Expand Up @@ -120,11 +120,11 @@ int main()

std::cout << "cam frame 0 viewmatrix:\n" << ptrs[0]->getViewMatrix() << std::endl;

m1t.setToIdentity();
m1tor.setToIdentity();
m1r.setToIdentity();
m1torb.setToIdentity();
m1t2.setToIdentity();
m1t.set_identity();
m1tor.set_identity();
m1r.set_identity();
m1torb.set_identity();
m1t2.set_identity();

m1t.translate (cshift1);

Expand Down
2 changes: 1 addition & 1 deletion examples/duochrome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main()
try {
sm::vec<float, 3> offset = { 0.0, 0.0, 0.0 };
sm::scale<float> scale;
scale.setParams (1.0, 0.0);
scale.set_params (1.0, 0.0);

std::vector<sm::vec<float, 3>> points(slen*slen);
std::vector<sm::vec<float, 3>> vecdata(slen*slen);
Expand Down
4 changes: 2 additions & 2 deletions examples/ellipse_pca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <sm/mathconst>
#include <sm/random>
#include <sm/mat22>
#include <sm/mat>

#include <armadillo>

Expand All @@ -20,7 +20,7 @@ int main()
sm::rand_normal<float> rn1 (0.0f, 2.0f);
sm::rand_normal<float> rn2 (0.0f, 0.5f);
sm::vvec<sm::vec<float, 2>> _x (n_samp, {0});
sm::mat22<float> rotn;
sm::mat<float, 2> rotn;
rotn.rotate (sm::mathconst<float>::pi_over_8);
for (unsigned int i = 0; i < n_samp; ++i) {
_x[i] = rotn * sm::vec<float, 2>{ rn1.get(), rn2.get() };
Expand Down
3 changes: 2 additions & 1 deletion examples/ellipsoid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <sstream>

#include <sm/vec>
#include <sm/mat>

#include <mplot/Visual.h>
#include <mplot/VisualModel.h>
Expand All @@ -22,7 +23,7 @@ class PrimitiveVisual : public mplot::VisualModel<glver>

void initializeVertices()
{
sm::mat44<float> tr;
sm::mat<float, 4> tr;
tr.rotate (sm::vec<>::uz(), sm::mathconst<float>::pi_over_4);
this->computeEllipsoid (sm::vec<float>{0},
mplot::colour::royalblue,
Expand Down
8 changes: 4 additions & 4 deletions examples/grid_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main()
gv1->gridVisMode = mplot::GridVisMode::Triangles;
gv1->setScalarData (&image_data_tlbr);
gv1->cm.setType (mplot::ColourMapType::GreyscaleInv); // inverse greyscale is good for a monochrome image
gv1->zScale.setParams (0, 1); // As it's an image, we don't want relief, so set the zScale to have a zero gradient
gv1->zScale.set_params (0, 1); // As it's an image, we don't want relief, so set the zScale to have a zero gradient
gv1->finalize();
v.addVisualModel (gv1);

Expand All @@ -54,7 +54,7 @@ int main()
gv2->gridVisMode = mplot::GridVisMode::Triangles;
gv2->setScalarData (&image_data_bltr);
gv2->cm.setType (mplot::ColourMapType::GreyscaleInv);
gv2->zScale.setParams (0, 1);
gv2->zScale.set_params (0, 1);
gv2->finalize();
v.addVisualModel (gv2);

Expand All @@ -63,7 +63,7 @@ int main()
gv3->gridVisMode = mplot::GridVisMode::RectInterp;
gv3->setScalarData (&image_data_tlbr);
gv3->cm.setType (mplot::ColourMapType::GreyscaleInv);
gv3->zScale.setParams (0, 1);
gv3->zScale.set_params (0, 1);
gv3->finalize();
v.addVisualModel (gv3);

Expand All @@ -72,7 +72,7 @@ int main()
gv4->gridVisMode = mplot::GridVisMode::RectInterp;
gv4->setScalarData (&image_data_bltr);
gv4->cm.setType (mplot::ColourMapType::GreyscaleInv);
gv4->zScale.setParams (0, 1);
gv4->zScale.set_params (0, 1);
gv4->finalize();
v.addVisualModel (gv4);

Expand Down
2 changes: 1 addition & 1 deletion examples/hexgrid_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main()
// The inverse greyscale map is appropriate for a monochrome image
hgv->cm.setType (mplot::ColourMapType::GreyscaleInv);
// As it's an image, we don't want relief, so set the zScale to have a zero gradient
hgv->zScale.setParams (0, 1);
hgv->zScale.set_params (0, 1);

hgv->finalize();
v.addVisualModel (hgv);
Expand Down
2 changes: 1 addition & 1 deletion examples/hexgrid_image_onsphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int main()
hgv->setScalarData (&hex_image_data);
// The only real difference is that this has no hgv->setDataCoords(&sphere_coords) call.
hgv->cm.setType (mplot::ColourMapType::Inferno);
hgv->zScale.setParams (0, 1); // sets a z offset of 1 across the hexgrid
hgv->zScale.set_params (0, 1); // sets a z offset of 1 across the hexgrid
hgv->addLabel (std::string("2D hexgrid"),
sm::vec<float>{1.2*r_sph, -1.2*r_sph, 1},
mplot::TextFeatures(0.05f));
Expand Down
2 changes: 1 addition & 1 deletion examples/hexgrid_image_rect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int main()
// The inverse greyscale map is appropriate for a monochrome image
hgv->cm.setType (mplot::ColourMapType::GreyscaleInv);
// As it's an image, we don't want relief, so set the zScale to have a zero gradient
hgv->zScale.setParams (0, 1);
hgv->zScale.set_params (0, 1);

hgv->finalize();
v.addVisualModel (hgv);
Expand Down
6 changes: 4 additions & 2 deletions examples/model_crawler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <string>

#include <sm/vec>
#include <sm/mat>
#include <sm/vvec>

#include <mplot/Visual.h>
#include <mplot/ColourMap.h>
Expand Down Expand Up @@ -85,8 +87,8 @@ int main (int argc, char** argv)
sm::vec<float> mv_ca = sm::vec<float>::uz() * move_step;

// The viewmatrices have to be passed to mplot::NavMesh::compute_mesh_movement
sm::mat44<float> ca_view = cap->getViewMatrix();
sm::mat44<float> sph_view = gvp->getViewMatrix();
sm::mat<float, 4> ca_view = cap->getViewMatrix();
sm::mat<float, 4> sph_view = gvp->getViewMatrix();

// Find the triangle that we're initially located above with
// mplot::NavMesh::find_triangle_hit. This updates internal state in NavMesh. It could be
Expand Down
4 changes: 2 additions & 2 deletions examples/pi/convolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ int main()
auto rgvp = v.addVisualModel (rgv);

// Demonstrate how to divide existing scale by 10:
float newGrad = hgvp->zScale.getParams(0) / 10.0f;
float newGrad = hgvp->zScale.get_params(0) / 10.0f;
// Set this in a new zscale object:
sm::scale<float> zscale;
zscale.setParams (newGrad, 0);
zscale.set_params (newGrad, 0);
// Use the un-owned pointer rgvp:
rgvp->updateZScale (zscale);

Expand Down
2 changes: 1 addition & 1 deletion examples/pointrows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main()
try {
sm::vec<float, 3> offset = { 0.0, 0.0, 0.0 };
sm::scale<float> scale;
scale.setParams (1.0, 0.0);
scale.set_params (1.0, 0.0);

std::vector<sm::vec<float, 3>> points;
std::vector<float> data; // copy points[:][2] into data
Expand Down
2 changes: 1 addition & 1 deletion examples/quads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main()
try {
sm::vec<float, 3> offset = { 0.0, 0.0, 0.0 };
sm::scale<float> scale1;
scale1.setParams (1.0, 0.0);
scale1.set_params (1.0, 0.0);

std::vector<std::array<float, 12>> surfBoxes;

Expand Down
2 changes: 1 addition & 1 deletion examples/rosenbrock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int main()
hgv->hexVisMode = mplot::HexVisMode::Triangles;
hgv->cm.setType (mplot::ColourMapType::Viridis);
hgv->setScalarData (&banana_vals);
hgv->zScale.setParams (0.001f, 0.0f);
hgv->zScale.set_params (0.001f, 0.0f);
hgv->colourScale.compute_scaling (0.01f, 5.0f);
hgv->setAlpha (0.4f);
hgv->finalize();
Expand Down
2 changes: 1 addition & 1 deletion examples/rosenbrock_asa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int main()
hgv->hexVisMode = mplot::HexVisMode::Triangles;
hgv->cm.setType (mplot::ColourMapType::Viridis);
hgv->setScalarData (&banana_vals);
hgv->zScale.setParams (0.001f, 0.0f);
hgv->zScale.set_params (0.001f, 0.0f);
hgv->colourScale.compute_scaling (0.01f, 5.0f);
hgv->setAlpha (0.4f);
hgv->finalize();
Expand Down
1 change: 0 additions & 1 deletion examples/rotating_models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <sm/vec>
#include <sm/quaternion>
#include <sm/mat44>

#include <mplot/Visual.h>
#include <mplot/ColourMap.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/scatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int main()
try {
sm::vec<float, 3> offset = { 0.0, 0.0, 0.0 };
sm::scale<float> scale1;
scale1.setParams (1.0, 0.0);
scale1.set_params (1.0, 0.0);

// Note use of sm::vvecs here, which can be passed into
// VisualDataModel::setDataCoords(std::vector<vec<float>>* _coords)
Expand Down
2 changes: 1 addition & 1 deletion examples/scatter_geodesic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int main()
try {
sm::vec<float, 3> offset = { 0.0f, 0.0f, 0.0f };
sm::scale<float> scale;
scale.setParams (1.0f, 0.0f);
scale.set_params (1.0f, 0.0f);

sm::vvec<float> data(geo.poly.vertices.size(), 0.06f);
sm::vvec<float> data2(geo.poly.faces.size(), 0.95f);
Expand Down
2 changes: 1 addition & 1 deletion examples/scatter_hex_mercator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main()

sm::vec<float, 3> offset = { 0.0f, 0.0f, 0.0f };
sm::scale<float> scale;
scale.setParams (1.0f, 0.0f);
scale.set_params (1.0f, 0.0f);

// Have a Sphere of radius 1
constexpr float r_sph = 1.0f;
Expand Down
2 changes: 1 addition & 1 deletion examples/scatter_ico.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main()
try {
sm::vec<float, 3> offset = { 0.0, 0.0, 0.0 };
sm::scale<float, float> scale;
scale.setParams (1.0, 0.0);
scale.set_params (1.0, 0.0);

sm::vvec<float> data(12, 0.06f);
sm::vvec<float> data2(20, 0.95f);
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ int main()
gv3->interpolate_colour_sides (true);
gv3->setScalarData (&image_data);
gv3->cm.setType (mplot::ColourMapType::Plasma);
gv3->zScale.setParams (0.1, 0); // Reduce height in 'z'
gv3->zScale.set_params (0.1, 0); // Reduce height in 'z'
gv3->addLabel ("mplot::GridVisual (columns)", sm::vec<float>({0,-0.1,0}), mplot::TextFeatures(0.05));
gv3->finalize();
v.addVisualModel (gv3);
Expand Down
6 changes: 3 additions & 3 deletions examples/vectorvis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <sm/vec>
#include <sm/quaternion>
#include <sm/mat44>
#include <sm/mat>

#include <mplot/Visual.h>
#include <mplot/ColourMap.h>
Expand Down Expand Up @@ -37,7 +37,7 @@ int main()
vvm->thevec = {1,1,1};
vvm->fixed_colour = true;
vvm->single_colour = mplot::colour::royalblue;
vvm->addLabel ("Rotn by mat44", {-0.8, -0.5, 0}, mplot::TextFeatures(0.1f));
vvm->addLabel ("Rotn by 4x4 mat", {-0.8, -0.5, 0}, mplot::TextFeatures(0.1f));
vvm->finalize();
auto ptr2 = v.addVisualModel (vvm);

Expand All @@ -49,7 +49,7 @@ int main()
// Set up a rotation about the z axis
sm::quaternion<float> qr (axis, angle_per_frame);

sm::mat44<float> tf;
sm::mat<float, 4, 4> tf;
tf.rotate (axis, angle_per_frame);

while (!v.readyToFinish()) {
Expand Down
Loading
Loading