summaryrefslogtreecommitdiff
path: root/assets/viz/2/quil/middlewares/navigation_3d.js
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2018-11-13 00:24:09 -0500
committerBrian Picciano <mediocregopher@gmail.com>2018-11-13 00:24:09 -0500
commit2b4757367470d8e36bc00901dac567e375796ed4 (patch)
tree72368624006c21d28228a100ee88590c7bf95e58 /assets/viz/2/quil/middlewares/navigation_3d.js
parent5ed62d23b4bbbf7717de4adfa0eaf2af19365408 (diff)
update viz 2 to use the newest version, which has some performance improvements and is easier to read the code for. also update the description
Diffstat (limited to 'assets/viz/2/quil/middlewares/navigation_3d.js')
-rw-r--r--assets/viz/2/quil/middlewares/navigation_3d.js118
1 files changed, 59 insertions, 59 deletions
diff --git a/assets/viz/2/quil/middlewares/navigation_3d.js b/assets/viz/2/quil/middlewares/navigation_3d.js
index 54cac9e..d80d58a 100644
--- a/assets/viz/2/quil/middlewares/navigation_3d.js
+++ b/assets/viz/2/quil/middlewares/navigation_3d.js
@@ -1,8 +1,8 @@
-// Compiled by ClojureScript 1.9.473 {}
+// Compiled by ClojureScript 1.10.439 {}
goog.provide('quil.middlewares.navigation_3d');
goog.require('cljs.core');
goog.require('quil.core');
-quil.middlewares.navigation_3d.missing_navigation_key_error = [cljs.core.str.cljs$core$IFn$_invoke$arity$1("state map is missing :navigation-3d key. "),cljs.core.str.cljs$core$IFn$_invoke$arity$1("Did you accidentally removed it from the state in "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(":update or any other handler?")].join('');
+quil.middlewares.navigation_3d.missing_navigation_key_error = ["state map is missing :navigation-3d key. ","Did you accidentally removed it from the state in ",":update or any other handler?"].join('');
/**
* Asserts that state map contains :navigation-2d object.
*/
@@ -26,14 +26,14 @@ return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"po
* http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
*/
quil.middlewares.navigation_3d.rotate_by_axis_and_angle = (function quil$middlewares$navigation_3d$rotate_by_axis_and_angle(v,axis,angle){
-var vec__8901 = axis;
-var a_x = cljs.core.nth.call(null,vec__8901,(0),null);
-var a_y = cljs.core.nth.call(null,vec__8901,(1),null);
-var a_z = cljs.core.nth.call(null,vec__8901,(2),null);
-var vec__8904 = v;
-var x = cljs.core.nth.call(null,vec__8904,(0),null);
-var y = cljs.core.nth.call(null,vec__8904,(1),null);
-var z = cljs.core.nth.call(null,vec__8904,(2),null);
+var vec__1620 = axis;
+var a_x = cljs.core.nth.call(null,vec__1620,(0),null);
+var a_y = cljs.core.nth.call(null,vec__1620,(1),null);
+var a_z = cljs.core.nth.call(null,vec__1620,(2),null);
+var vec__1623 = v;
+var x = cljs.core.nth.call(null,vec__1623,(0),null);
+var y = cljs.core.nth.call(null,vec__1623,(1),null);
+var z = cljs.core.nth.call(null,vec__1623,(2),null);
var cs = quil.core.cos.call(null,angle);
var _cs = ((1) - cs);
var sn = quil.core.sin.call(null,angle);
@@ -58,23 +58,23 @@ return cljs.core.update_in.call(null,nav_3d,new cljs.core.PersistentVector(null,
/**
* Vector cross-product: http://en.wikipedia.org/wiki/Cross_product
*/
-quil.middlewares.navigation_3d.cross_product = (function quil$middlewares$navigation_3d$cross_product(p__8907,p__8908){
-var vec__8915 = p__8907;
-var u1 = cljs.core.nth.call(null,vec__8915,(0),null);
-var u2 = cljs.core.nth.call(null,vec__8915,(1),null);
-var u3 = cljs.core.nth.call(null,vec__8915,(2),null);
-var vec__8918 = p__8908;
-var v1 = cljs.core.nth.call(null,vec__8918,(0),null);
-var v2 = cljs.core.nth.call(null,vec__8918,(1),null);
-var v3 = cljs.core.nth.call(null,vec__8918,(2),null);
+quil.middlewares.navigation_3d.cross_product = (function quil$middlewares$navigation_3d$cross_product(p__1626,p__1627){
+var vec__1628 = p__1626;
+var u1 = cljs.core.nth.call(null,vec__1628,(0),null);
+var u2 = cljs.core.nth.call(null,vec__1628,(1),null);
+var u3 = cljs.core.nth.call(null,vec__1628,(2),null);
+var vec__1631 = p__1627;
+var v1 = cljs.core.nth.call(null,vec__1631,(0),null);
+var v2 = cljs.core.nth.call(null,vec__1631,(1),null);
+var v3 = cljs.core.nth.call(null,vec__1631,(2),null);
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [((u2 * v3) - (u3 * v2)),((u3 * v1) - (u1 * v3)),((u1 * v2) - (u2 * v1))], null);
});
/**
* Multiply vector v by scalar mult.
*/
quil.middlewares.navigation_3d.v_mult = (function quil$middlewares$navigation_3d$v_mult(v,mult){
-return cljs.core.mapv.call(null,(function (p1__8921_SHARP_){
-return (p1__8921_SHARP_ * mult);
+return cljs.core.mapv.call(null,(function (p1__1634_SHARP_){
+return (p1__1634_SHARP_ * mult);
}),v);
});
/**
@@ -103,8 +103,8 @@ return quil.middlewares.navigation_3d.v_mult.call(null,v,((1) / norm));
quil.middlewares.navigation_3d.rotate_ud = (function quil$middlewares$navigation_3d$rotate_ud(nav_3d,angle){
var axis = quil.middlewares.navigation_3d.cross_product.call(null,new cljs.core.Keyword(null,"straight","straight",-1252567854).cljs$core$IFn$_invoke$arity$1(nav_3d),new cljs.core.Keyword(null,"up","up",-269712113).cljs$core$IFn$_invoke$arity$1(nav_3d));
var rotate = ((function (axis){
-return (function (p1__8922_SHARP_){
-return quil.middlewares.navigation_3d.rotate_by_axis_and_angle.call(null,p1__8922_SHARP_,axis,angle);
+return (function (p1__1635_SHARP_){
+return quil.middlewares.navigation_3d.rotate_by_axis_and_angle.call(null,p1__1635_SHARP_,axis,angle);
});})(axis))
;
return cljs.core.update_in.call(null,cljs.core.update_in.call(null,nav_3d,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854)], null),rotate),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"up","up",-269712113)], null),rotate);
@@ -125,8 +125,8 @@ var dy = (new cljs.core.Keyword(null,"y","y",-1757859776).cljs$core$IFn$_invoke$
var angle_lr = quil.core.map_range.call(null,dx,(0),pixels_in_360,(0),quil.core.TWO_PI);
var angle_ud = quil.core.map_range.call(null,dy,(0),pixels_in_360,(0),quil.core.TWO_PI);
return cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301)], null),((function (dx,dy,angle_lr,angle_ud){
-return (function (p1__8923_SHARP_){
-return quil.middlewares.navigation_3d.rotate_ud.call(null,quil.middlewares.navigation_3d.rotate_lr.call(null,p1__8923_SHARP_,angle_lr),angle_ud);
+return (function (p1__1636_SHARP_){
+return quil.middlewares.navigation_3d.rotate_ud.call(null,quil.middlewares.navigation_3d.rotate_lr.call(null,p1__1636_SHARP_,angle_lr),angle_ud);
});})(dx,dy,angle_lr,angle_ud))
);
}
@@ -140,28 +140,28 @@ quil.middlewares.navigation_3d.space = cljs.core.keyword.call(null," ");
quil.middlewares.navigation_3d.move = (function quil$middlewares$navigation_3d$move(state,event,step_size){
quil.middlewares.navigation_3d.assert_state_has_navigation.call(null,state);
-var map__8930 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state);
-var map__8930__$1 = ((((!((map__8930 == null)))?((((map__8930.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__8930.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__8930):map__8930);
-var up = cljs.core.get.call(null,map__8930__$1,new cljs.core.Keyword(null,"up","up",-269712113));
-var straight = cljs.core.get.call(null,map__8930__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854));
-var temp__4655__auto__ = (function (){var pred__8932 = cljs.core._EQ_;
-var expr__8933 = new cljs.core.Keyword(null,"key","key",-1516042587).cljs$core$IFn$_invoke$arity$1(event);
-if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"w","w",354169001),expr__8933))){
+var map__1638 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state);
+var map__1638__$1 = (((((!((map__1638 == null))))?(((((map__1638.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__1638.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__1638):map__1638);
+var up = cljs.core.get.call(null,map__1638__$1,new cljs.core.Keyword(null,"up","up",-269712113));
+var straight = cljs.core.get.call(null,map__1638__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854));
+var temp__4655__auto__ = (function (){var pred__1640 = cljs.core._EQ_;
+var expr__1641 = new cljs.core.Keyword(null,"key","key",-1516042587).cljs$core$IFn$_invoke$arity$1(event);
+if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"w","w",354169001),expr__1641))){
return straight;
} else {
-if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"s","s",1705939918),expr__8933))){
+if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"s","s",1705939918),expr__1641))){
return quil.middlewares.navigation_3d.v_opposite.call(null,straight);
} else {
-if(cljs.core.truth_(pred__8932.call(null,quil.middlewares.navigation_3d.space,expr__8933))){
+if(cljs.core.truth_(pred__1640.call(null,quil.middlewares.navigation_3d.space,expr__1641))){
return quil.middlewares.navigation_3d.v_opposite.call(null,up);
} else {
-if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"z","z",-789527183),expr__8933))){
+if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"z","z",-789527183),expr__1641))){
return up;
} else {
-if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"d","d",1972142424),expr__8933))){
+if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"d","d",1972142424),expr__1641))){
return quil.middlewares.navigation_3d.cross_product.call(null,straight,up);
} else {
-if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"a","a",-2123407586),expr__8933))){
+if(cljs.core.truth_(pred__1640.call(null,new cljs.core.Keyword(null,"a","a",-2123407586),expr__1641))){
return quil.middlewares.navigation_3d.cross_product.call(null,up,straight);
} else {
return null;
@@ -174,10 +174,10 @@ return null;
})();
if(cljs.core.truth_(temp__4655__auto__)){
var dir = temp__4655__auto__;
-return cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301),new cljs.core.Keyword(null,"position","position",-2011731912)], null),((function (dir,temp__4655__auto__,map__8930,map__8930__$1,up,straight){
-return (function (p1__8924_SHARP_){
-return quil.middlewares.navigation_3d.v_plus.call(null,p1__8924_SHARP_,quil.middlewares.navigation_3d.v_mult.call(null,dir,step_size));
-});})(dir,temp__4655__auto__,map__8930,map__8930__$1,up,straight))
+return cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301),new cljs.core.Keyword(null,"position","position",-2011731912)], null),((function (dir,temp__4655__auto__,map__1638,map__1638__$1,up,straight){
+return (function (p1__1637_SHARP_){
+return quil.middlewares.navigation_3d.v_plus.call(null,p1__1637_SHARP_,quil.middlewares.navigation_3d.v_mult.call(null,dir,step_size));
+});})(dir,temp__4655__auto__,map__1638,map__1638__$1,up,straight))
);
} else {
return state;
@@ -190,8 +190,8 @@ return state;
quil.middlewares.navigation_3d.setup_3d_nav = (function quil$middlewares$navigation_3d$setup_3d_nav(user_setup,user_settings){
var initial_state = cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.merge.call(null,quil.middlewares.navigation_3d.default_position.call(null),cljs.core.select_keys.call(null,user_settings,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854),new cljs.core.Keyword(null,"up","up",-269712113),new cljs.core.Keyword(null,"position","position",-2011731912)], null))),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854)], null),quil.middlewares.navigation_3d.v_normalize),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"up","up",-269712113)], null),quil.middlewares.navigation_3d.v_normalize);
return cljs.core.update_in.call(null,user_setup.call(null),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301)], null),((function (initial_state){
-return (function (p1__8935_SHARP_){
-return cljs.core.merge.call(null,initial_state,p1__8935_SHARP_);
+return (function (p1__1643_SHARP_){
+return cljs.core.merge.call(null,initial_state,p1__1643_SHARP_);
});})(initial_state))
);
});
@@ -229,21 +229,21 @@ return cljs.core.assoc.call(null,options,new cljs.core.Keyword(null,"setup","set
return (function (state){
quil.middlewares.navigation_3d.assert_state_has_navigation.call(null,state);
-var map__8947_8958 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state);
-var map__8947_8959__$1 = ((((!((map__8947_8958 == null)))?((((map__8947_8958.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__8947_8958.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__8947_8958):map__8947_8958);
-var vec__8948_8960 = cljs.core.get.call(null,map__8947_8959__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854));
-var c_x_8961 = cljs.core.nth.call(null,vec__8948_8960,(0),null);
-var c_y_8962 = cljs.core.nth.call(null,vec__8948_8960,(1),null);
-var c_z_8963 = cljs.core.nth.call(null,vec__8948_8960,(2),null);
-var vec__8951_8964 = cljs.core.get.call(null,map__8947_8959__$1,new cljs.core.Keyword(null,"up","up",-269712113));
-var u_x_8965 = cljs.core.nth.call(null,vec__8951_8964,(0),null);
-var u_y_8966 = cljs.core.nth.call(null,vec__8951_8964,(1),null);
-var u_z_8967 = cljs.core.nth.call(null,vec__8951_8964,(2),null);
-var vec__8954_8968 = cljs.core.get.call(null,map__8947_8959__$1,new cljs.core.Keyword(null,"position","position",-2011731912));
-var p_x_8969 = cljs.core.nth.call(null,vec__8954_8968,(0),null);
-var p_y_8970 = cljs.core.nth.call(null,vec__8954_8968,(1),null);
-var p_z_8971 = cljs.core.nth.call(null,vec__8954_8968,(2),null);
-quil.core.camera.call(null,p_x_8969,p_y_8970,p_z_8971,(p_x_8969 + c_x_8961),(p_y_8970 + c_y_8962),(p_z_8971 + c_z_8963),u_x_8965,u_y_8966,u_z_8967);
+var map__1644_1655 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state);
+var map__1644_1656__$1 = (((((!((map__1644_1655 == null))))?(((((map__1644_1655.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__1644_1655.cljs$core$ISeq$))))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__1644_1655):map__1644_1655);
+var vec__1645_1657 = cljs.core.get.call(null,map__1644_1656__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854));
+var c_x_1658 = cljs.core.nth.call(null,vec__1645_1657,(0),null);
+var c_y_1659 = cljs.core.nth.call(null,vec__1645_1657,(1),null);
+var c_z_1660 = cljs.core.nth.call(null,vec__1645_1657,(2),null);
+var vec__1648_1661 = cljs.core.get.call(null,map__1644_1656__$1,new cljs.core.Keyword(null,"up","up",-269712113));
+var u_x_1662 = cljs.core.nth.call(null,vec__1648_1661,(0),null);
+var u_y_1663 = cljs.core.nth.call(null,vec__1648_1661,(1),null);
+var u_z_1664 = cljs.core.nth.call(null,vec__1648_1661,(2),null);
+var vec__1651_1665 = cljs.core.get.call(null,map__1644_1656__$1,new cljs.core.Keyword(null,"position","position",-2011731912));
+var p_x_1666 = cljs.core.nth.call(null,vec__1651_1665,(0),null);
+var p_y_1667 = cljs.core.nth.call(null,vec__1651_1665,(1),null);
+var p_z_1668 = cljs.core.nth.call(null,vec__1651_1665,(2),null);
+quil.core.camera.call(null,p_x_1666,p_y_1667,p_z_1668,(p_x_1666 + c_x_1658),(p_y_1667 + c_y_1659),(p_z_1668 + c_z_1660),u_x_1662,u_y_1663,u_z_1664);
return draw.call(null,state);
});})(user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn,setup))
@@ -258,4 +258,4 @@ return rotate_on_fn.call(null,quil.middlewares.navigation_3d.rotate.call(null,st
);
});
-//# sourceMappingURL=navigation_3d.js.map \ No newline at end of file
+//# sourceMappingURL=navigation_3d.js.map