google-map-react/google-map-react 4710
Google map library for react that allows rendering components as markers :tada:
A runtime type system for JavaScript with full Flow compatibility.
Template your base files and generate new projects from Git(Hub).
Meteor/Webpack/React SSR app skeleton that runs your app code outside of Meteor Isobuild
simple light-weight side effects for redux
jcoreio/react-router-drilldown 12
provides drilldown-style horizontal slide transitions between index and child routes
jedwards1211/async-child-process 6
Promise-based child process interface (you might want to use promisify-child-process instead!)
codemodsquad/jscodeshift-add-imports 2
add imports/requires if not already present with jscodeshift
codemodsquad/jscodeshift-build-import-list 2
build a list of all files and dependencies transitively imported by starting file(s)
codemodsquad/jscodeshift-find-imports 1
find imported/required identifiers with jscodeshift
push eventjcoreio/deploy-new-john-zink-clarity-prod
commit sha 464a102ec01dd31f7365721da31c1ecf0c14b669
fix: use @jcoreio/[email protected]
push time in 4 hours
create barnchjcoreio/deploy-new-john-zink-clarity-prod
created branch time in 4 hours
issue commentcasesandberg/react-color
Module not found for '@icons/material/...' - when installing as peer of @storybook/addon-docs
I also discovered that yarn has a --mutex option that can guard against the simultaneous install issue, but it's not on by default unfortunately.
comment created time in 7 hours
created tagjcoreio/promake-node-modules
promake recipe for installing node_modules only when necessary
created time in 9 hours
push eventjcoreio/promake-node-modules
commit sha 2638c01b59d396410c909b74f6d4dcafb82ad262
feat: prevent install processes from running simultaneously
push time in 9 hours
issue commentcasesandberg/react-color
Module not found for '@icons/material/...' - when installing as peer of @storybook/addon-docs
@hendriku Are you using yarn? I realized what happened in my case: I accidentally ran two yarn install processes at once, and this messed up the yarn cache (which explains why the package.json was also missing). Doing yarn cache clean && rm -rf node_modules && yarn fixed it for me.
comment created time in 10 hours
issue commentyarnpkg/yarn
I ran into a similar issue and realized why: my yarn cache got messed up because I accidentally ran two yarn install commands simultaneously. (I run my server process and webpack dev server process in separate terminals and both run yarn install if the node_modules are out of date)
comment created time in 10 hours
issue commentcasesandberg/react-color
Module not found for '@icons/material/...' - when installing as peer of @storybook/addon-docs
Pinning with yarn solved this for me:
"resolutions": {
"@icons/material": "0.4.0"
},
But man this is the stuff of nightmares.
comment created time in 10 hours
issue commentcasesandberg/react-color
Module not found for '@icons/material/...' - when installing as peer of @storybook/addon-docs
How the hell does a file go missing from a package published two years ago? Not even sure I can trust NPM when bizarre things like this happen
comment created time in 11 hours
issue commentcasesandberg/react-color
Module not found for '@icons/material/...' - when installing as peer of @storybook/addon-docs
Same here.
Curiously, when trying to confirm the installed version, I noticed there's no node_modules/@icons/material/package.json. Kinda messed up...
comment created time in 11 hours
push eventjcoreio/promake-node-modules
commit sha 1e7231e01e971f5f8a71cf3c82ef5937ec476806
chore: upgrade toolchain
push time in 11 hours
created tagjcoreio/promake-node-modules
promake recipe for installing node_modules only when necessary
created time in 11 hours
push eventjcoreio/promake-node-modules
commit sha 9746189665be8fe1314e83f1385b60309bad6971
fix: CommonJS default export
push time in 11 hours
push eventjcoreio/toolchains
commit sha fd50bc2554b31d5f634bd18c5853e20db174aea1
fix: lint-staged config
push time in 11 hours
push eventjcoreio/toolchains
commit sha 88509b83b2c266db20d442824f545ad8ec0e5d36
fix(bootstrap): make config files easier to extend
commit sha ac524b544f68bb8f6dc6a8ac0a3acef4f3b7ee15
fix: upgrade @jedwards1211/commitlint-config
push time in 11 hours
push eventjedwards1211/commitlint-config
commit sha 43124a4734eefe5a9ae86368f5f6eebcd3e678da
fix: relax subject-case rule
push time in 11 hours
push eventjedwards1211/cito
commit sha 3d5b03e4c65f7f85d98aa6d9aceb00b34bea9bcc
test(OpEqualString): ignore pesky TS error
push time in 3 days
pull request commentpfusik/cito
TypeScript source/declarations generator
I've written a lot of JS code transformations using Babel, jscodeshift and recast, they put leadingComments and trailingComments on the AST nodes. It's tricky though, sometimes the comments disappear after a transform.
comment created time in 3 days
pull request commentpfusik/cito
TypeScript source/declarations generator
Yeah I was thinking about that, I'll give it a try
comment created time in 3 days
pull request commentpfusik/cito
TypeScript source/declarations generator
Yeah it does make ts-node exit with an error code when running the test. I guess I could just mark this case as failing for ts, the js test basically covers it...
why doesn't it complain about s == "foo"
Yeah it's kind of annoying, but I guess the idea is that "bar" could be a typo since it's deduced that s could never be that. As the error message says, it's when the types "have no overlap".
comment created time in 3 days
push eventjedwards1211/cito
commit sha 70c70e03d00f3ae358f393503a9baad5ce9041f3
test(RegexEscape): unmark js as failing
push time in 3 days
issue closedpfusik/cito
[GenJs] prefer triple-equals ===
I think a lot of JS programmers intentionally avoid == since its behavior is fairly complicated when any coercion is involved. The one exception is x == null is true if x is null or undefined, which is useful enough. === doesn't do any coercion and would work just fine since we're coming from strongly-typed code anyway.
closed time in 3 days
jedwards1211issue commentpfusik/cito
[GenJs] prefer triple-equals ===
I guess there wouldn't be any concrete advantages, I just have a habitual bias against double equals 😁
Theoretically === is a bit faster (https://stackoverflow.com/questions/12374815/javascript-vs-operators-performance) but the difference is pretty negligible, especially when no coercion needs to be done.
comment created time in 3 days
issue closedpfusik/cito
Extracting helper functions in generators
I was looking into implementing Regex.Escape for JS/TS. Even though it's pretty simple (string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')) I think it would be better to write a regexEscape helper function at the top of the file and then call it.
I haven't noticed evidence that GenJs currently does this for anything else...I think a generic mechanism to extract helper functions would be useful in a lot of situations.
This would make the rest of the translation simple to write:
Write(regexEscapeMethodName + '(');
pattern.Accept(this, CiPriority.Statement);
Write(')');
The main challenges would be
- Extracting a function needs to automatically add something to the function name if it would conflict with the user's own identifiers
- Since generation relies on sequential
Writecalls there's not currently a way to go back and insert something at the top of the output
What do you think? If nothing else we could run all the code through a visitor to decide what to extract before writing anything.
closed time in 3 days
jedwards1211issue commentpfusik/cito
Extracting helper functions in generators
Oh okay, great!
comment created time in 3 days
issue openedpfusik/cito
Extracting helper functions in generators
I was looking into implementing Regex.Escape for JS/TS. Even though it's pretty simple (string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')) I think it would be better to write a regexEscape helper function at the top of the file and then call it.
I haven't noticed evidence that GenJs currently does this for anything else...I think a generic mechanism to extract helper functions would be useful in a lot of situations.
This would make the rest of the translation simple to write:
Write(regexEscapeMethodName + '(');
pattern.Accept(this, CiPriority.Statement);
Write(')');
The main challenges would be
- Extracting a function needs to automatically add something to the function name if it would conflict with the user's own identifiers
- Since generation relies on sequential
Writecalls there's not currently a way to go back and insert something at the top of the output
What do you think? If nothing else we could run all the code through a visitor to decide what to extract before writing anything.
created time in 3 days
push eventjedwards1211/cito
commit sha 038338849cf95ceb829244f655e4ddbf07a9145a
test(RegexEscape): mark as failing for ts
push time in 3 days
push eventjedwards1211/cito
commit sha 3281b6d826443b1da109e3aea50184b9f7b2a523
fix(GenTs): generate correct types for Regex/Match
push time in 3 days
issue commentpfusik/cito
[GenJs] still expects 2 arguments to list.Insert
Oh makes sense, I think I didn't have the latest version of ci.md. Thanks!
comment created time in 3 days
push eventjedwards1211/cito
commit sha 8717749632376b299f7aae405682b3ffa284d7a4
chore: run test-ts in CI
push time in 3 days
push eventjedwards1211/cito
commit sha e372e6884d1093740456105b26939899264d8bf0
test: change TS target to es2017 to prevent test failures
push time in 3 days
pull request commentpfusik/cito
TypeScript source/declarations generator
If only comments were translated from .ci to the target language, I could put a // @ts-ignore comment in OpEqualString.ci.
comment created time in 3 days
pull request commentpfusik/cito
TypeScript source/declarations generator
I'm getting pretty close...trying to decide what to do about this annoying TypeScript error, which it seems like I can't disable:

comment created time in 3 days
issue openedpfusik/cito
[GenJs] prefer triple-equals ===
I think a lot of JS programmers intentionally avoid == since its behavior is fairly complicated when any coercion is involved. === is more strict and would work just fine since we're coming from strongly-typed code anyway.
created time in 3 days
push eventjedwards1211/cito
commit sha ad17d80fbb115baa8ed3d18b3f98526920b7ff38
[regex] Allow read-only Match references, disallow read-write.
commit sha c66d1d54f842972953466a48dc17a1fe5961a47c
[cpp] Fix NullReferenceException introduced in the previous commit.
commit sha d673b31f1f45bc1e5206b6ad6a064c0a1f93832b
[regex] Regex.Compile. WIP on #14
commit sha 8569de2b0cff67bfa2519602a7c5cbce7978e260
[regex] Instance overload for Regex.IsMatch. WIP on #14
commit sha 2de94cd5186137650aa3205ad3c882e8fb2efcca
[regex] Match.Find(str, regexObj). Close #14
commit sha 5f71b0636bcaefa9483658db708726c84b74bf59
[doc] Document Regex objects. #14
commit sha 4f0ad8a5986905e89b44ece3f387b89b455bc3e7
[pretty] Add .editorconfig.
commit sha 9502c8681ae6c84a324063f11557c6d149dce138
[test] Hide commands for "test-error".
commit sha 02f10de5c564b9cc57e34c7fbfc6a8d90289baf2
[doc] A paragraph on memory management.
commit sha c67f5fb6e89f104705b2c69138f576c1baad65c2
[test] Update .NET Core and Python.
commit sha 2ef5c3b983de03c9bfa91f706308470b7c484164
[list] Add/Insert object/array storage in C#, JavaScript, Python and Swift. #15
commit sha 87114863fe51c27b1c822da4f46097e04fac63d7
[list] Don't return reference to added/inserted storage.
commit sha b66e7c5bbaa7b0d39e7617b04a2dcf369225ca5e
feat: generate TypeScript declarations [WIP]
commit sha 12cfa1fba9628c3e8e6704bdd3a16a95cd6033f2
fix(GenTs): fix boolean and newline issues
commit sha af9d53eded6d73ee32221771176bf6f25421fdbc
fix(GenTs): get rid of overrides that throw not implemented, use JS visitors to generate enum value initializers
commit sha 33a38575de76a81a2f8f1f139dabd43b293f33fc
fix(CiTo): revert accidental formatting changes
commit sha 5e37e4f2ec8cda750254c22ea66be9d366c40085
chore(GenTs.cs): formatting
commit sha 1b354a8fa41a789d52823863be08f6a264e6554a
implement full TS code generation [WIP]
commit sha fe209b06eb74a7ddee35b5379c3f0fcb0a0c61f7
fix(GenTs): toposort output class order
commit sha 99f047cc630730ba95ed95e9ad8e143aca4b4147
use [] and {} for JS storage initializers, don't use private TS constructor for sealed classes
push time in 3 days
issue commentpfusik/cito
[GenJs] Outputs Object.entries, which isn't available in ES5
Oh I see that you already commented on that post. I guess you made the proposal? Since it was posted by some other guy I thought someone else was proposing it. $8192 for implementing a translator would be pretty sweet deal!
comment created time in 3 days
issue commentpfusik/cito
[GenJs] Outputs Object.entries, which isn't available in ES5
I see, I'm fine with not supporting old versions of JS as long as we document it and include some basic instructions on transpiling the generated JS to older versions with Babel.
I think we should make a table of what features don't work in target languages/versions, since I started running the tests on generated ts I noticed how many // FAIL comments there are for specific langs.
I noticed the other day that someone wants to implement a translator for Perl 6 aka Raku 🙃: https://news.perlfoundation.org/post/grant_proposal_cito_to_raku_translator
comment created time in 3 days
issue commentpfusik/cito
[GenJs] Outputs Object.entries, which isn't available in ES5
Yes most up-to-date browsers and recent versions of Node have almost all new features implemented. Here's another good site that shows what features are available in various versions of browsers and node: https://kangax.github.io/compat-table/es6/
I don't know if there's a market share table by JS version/features but this site says 5% of people are still using IE11. And IE11 doesn't support many ES6 features.
Since we have Babel, a great transpiler that can transpile modern JS code to run on much older environments, we certainly don't have to output pure ES5. But it would have to be called as a second step after cito for people who want to target old versions of JS. It would just be good to be specific about what version we're targeting.
comment created time in 4 days
push eventjedwards1211/cito
commit sha bb5054487a2b6910463b3b70d398b3013eb371a7
fix(GenTs): fix generated array and readonly types
commit sha d9209cc587aa0323376fc69929db3a82e04efe96
fix(GenTs): don't output readonly class types, private fields don't work
push time in 4 days
issue openedpfusik/cito
[GenJs] padStart, padEnd aren't available in ES5
One way you can check which version an API was added in is to look it up in devdocs (e.g. https://devdocs.io/javascript/global_objects/string/padstart) and scroll to the specifications section. If it's ES5 you should see ECMAScript 5.1 listed in the specifications.
We could also consider targeting a later version of JS.
created time in 4 days
issue openedpfusik/cito
[GenJs] Outputs Object.entries, which isn't available in ES5
https://github.com/pfusik/cito/blob/master/GenJs.cs#L671
Object.entries is from the 2017 version of ECMAScript. We should iterate over Object.keys instead and get the corresponding value inside the loop.
We could run the generated code through eslint to ensure that it's valid ES5 (or a later version that we choose). I could make a PR for that
created time in 4 days
issue openedpfusik/cito
[GenJs] still expects 2 arguments to list.Insert
GenCpp at least seems to expect the second argument to be optional:
else if (obj.Type is CiListType list2 && method.Name == "Insert") {
if (method.Parameters.Count == 1) {
GenJs doesn't:
else if (obj.Type is CiListType && method.Name == "Insert") {
obj.Accept(this, CiPriority.Primary);
Write(".splice(");
args[0].Accept(this, CiPriority.Statement);
Write(", 0, ");
args[1].Accept(this, CiPriority.Statement);
Write(')');
Also it's not documented what it means to omit the second argument.
LibListObjectStg.ci calls with one argument:
Test! u = list.Insert(0);
created time in 4 days
pull request commentpfusik/cito
TypeScript declarations generator
Okay. So yes we can write number[] | UInt8Array inline, and it's not overly verbose if we're only accepting the exact matching typed array besides number[].
comment created time in 4 days
push eventjedwards1211/breakout
commit sha e88a2fa99a484b067165a2211cc5cafcf4c62715
fix: show error message if app runs out of memory when loading or rebuilding model
push time in 4 days
push eventjedwards1211/cito
commit sha 99ed853bc81c5bd7c91ee0db9fd818f52561c82d
fix(GenTs.cs): more work in progress on number types
push time in 4 days
push eventjedwards1211/cito
commit sha 115f219e9440d4df1ea4850a672123dcd9677ed9
test: add Test.ts files to .PRECIOUS
push time in 4 days
pull request commentpfusik/cito
TypeScript declarations generator
I noticed in ci.md that
bytecorresponds tobytein Java, even though it is signed in Java. This is accomplished bycitoinjecting& 0xffin every retrieval of abytevalue
We could do this in JS too. JS has the usual bitwise operators; they convert the operands to 32-bit integers before performing the bitwise operation.
comment created time in 4 days
pull request commentpfusik/cito
TypeScript declarations generator
byte[]should accept anArrayorUInt8Array, but notInt8Arraybecause the latter one can have negative elements.
It's a tricky decision because Array (more precisely, Array<number> which is the same as number[]) can contain negative elements too, and for individual number types like byte, int etc we don't have any type safety guarantees at runtime.
I could look into using "opaque" types for numbers: https://codemix.com/opaque-types-in-javascript/ Opaque types are a core feature of Flow (the other main JS type checker I mentioned) and something you can simulate in TypeScript as mentioned in that article.
Here's an example of how it could work TypeScript playground link:
type Opaque<K, T> = T & { __TYPE__: K };
type Int8 = Opaque<'Int8', number>
type Int16 = Opaque<'UInt8' | 'Int8' | 'Int16', number>
const foo: Int8 = 5 as Int8 // API users would have to explicitly cast numbers, which is a bit awkward
const bar: Int16 = foo // Int16 can accept an Int8 :)
const baz: Int8 = bar // Int8 can't accept an Int16 :) produces desired error: Type 'Opaque<"Int8" | "UInt8" | "Int16", number>' is not assignable to type 'Opaque<"Int8", number>'.
What do you think?
comment created time in 4 days
pull request commentpfusik/cito
TypeScript declarations generator
As far as a function that can accept any of the numeric array types, unfortunately TS doesn't seem to have a builtin interface that includes all of the methods common to them that Cito uses. We could inline one like type NumericArray = number[] | UInt8Array | Int8Array etc. though there are a lot of variants. Another option is to publish one in a cito-types package and import it in the generated code.
comment created time in 5 days
push eventjedwards1211/breakout
commit sha 4b351890f3b4456a5c907f7170eae7607a011ea4
feat(HintLabels): add elevation, reorganize layout
commit sha 2ddd3f7e5f1b5774c602c7d01ef0561d092b165c
fix(Survey3dModel): add detailed status for label generation
push time in 5 days
issue openedjedwards1211/breakout
[Geom Generation] don't use bisector LRUD facing azimuth when survey doubles back on itself
created time in 5 days
issue commentjcoreio/material-ui-popup-state
How to test component in testing-library?
Sorry for the delay. If you want the button to toggle the popup open/closed then you can use bindToggle instead of bindTrigger, which always sets the popover open when clicked. (It may seem like clicking the bindTrigger button a second time closes the popover, but what's really happening is the popover backdrop, which is enabled by default, intercepts the mouse event and calls its onClose handler.
I'm actually not sure how to trigger a backdrop click in an automated test, right now my own tests call the callback functions directly. I'll investigate this further...
comment created time in 5 days
push eventjedwards1211/breakout
commit sha 8a3451863149a6cb886fe65ac0a3486451b276f6
fix(HintLabels): clean up and improve layout
commit sha 7584cf9ec55cf125d2f2d6f713671dce5445930d
fix(SettingsDrawer): make sensitivity sliders exponential
push time in 5 days
push eventjedwards1211/breakout
commit sha aad9941ec995862c6fd1174bd247fe8c93a86cb8
fix: prev day/month/year buttons
push time in 5 days
push eventjedwards1211/breakout
commit sha 5d10aa5940d2a22b85ca3d8d72b378e359facae2
fix: make best route/shortest route respect time machine
push time in 5 days
push eventjedwards1211/breakout
commit sha 2fb64c1207eb5fd76413dc68fe224a43088e1f1c
fix: improve layout of hint labels
push time in 5 days
pull request commentpfusik/cito
TypeScript declarations generator
Makes sense, I had just naively assumed constant number arrays would be treated the same as other array storage. I'll make GenTs use number[] for constant array types then
comment created time in 5 days
pull request commentpfusik/cito
TypeScript declarations generator
So for the statement const int[] a = { 5, 10, 15 };, the GenJs codepath leads to WriteVarInit. Which passes the Value to the visitor. But since the Value is a CiCollection, GenJs just outputs [ 5, 10, 15 ] for it instead of new Int32Array or some such.
This is causing a problem for GenTs since it chooses Int32Array for the output type. But this errors since you can't assign an Int32Array using an array literal:
private static readonly RUN_A: Int32Array = [ 5, 10, 15 ]; // error
comment created time in 5 days
pull request commentpfusik/cito
TypeScript declarations generator
regardless of how many times it is reached
Oh I wasn't thinking, no it would reallocate every time
comment created time in 5 days
pull request commentpfusik/cito
TypeScript declarations generator
Extracting constants like this is rather pointless in JS:
Test.run = function()
{
switch (3) {
case 3:
return Test.RUN_A[1] == 10;
default:
return false;
}
}
Test.RUN_A = [ 5, 10, 15 ];
In TS I can use const a: number[] = [ 5, 10, 15 ] (or equivalent for Int32Array etc)
ES6 also has const.
comment created time in 5 days
pull request commentpfusik/cito
TypeScript declarations generator
I made this change in GenJs:
protected override void WriteListStorageInit(CiListType list)
{
Write(" = []");
}
protected override void WriteDictionaryStorageInit(CiDictionaryType dict)
{
Write(" = {}");
}
For two reasons:
- TS doesn't accept
const foo: Record<any, any> = new Object()(and I assume same for array) - It's more idiomatic and apparently faster too
comment created time in 5 days
push eventjedwards1211/cito
commit sha e3f71357f6d2ece06314c948087610a61d009d83
use [] and {} for JS storage initializers, don't use private TS constructor for sealed classes
push time in 5 days
push eventjedwards1211/cito
commit sha ab59f528daf073448402ee035163f4a2607e81e1
fix(GenTs): toposort output class order
push time in 5 days
pull request commentpfusik/cito
TypeScript declarations generator
I really appreciated how the class hierarchy is structured when I noticed that simply by inheriting from GenJs and overriding GenTypeAndName in GenTs, all the output variable declarations have a type annotation 🙂
comment created time in 5 days
pull request commentpfusik/cito
TypeScript declarations generator
Thanks for pointing out the toposort in GenCpp!
In the long run I'd like to make GenTs and also a GenJsFlow (Flow is another static type checker for JavaScript) inherit from a base generator for ECMAScript >= 6. I haven't decided if I want to allow the user to pick what version of ECMAScript to output or just pick some version > 5 (GenJs outputs ES5 currently, classes and a lot of things were added in ES6 but they're up to ES11 already 🙃)
comment created time in 5 days
push eventjedwards1211/breakout
commit sha a8820bdbb9ea0a0ccf475cd953d04940bee98a97
chore(poms): bump version
commit sha eca0f77438c5bc4181cfbd734eb9098d70f1af63
fix: survey drawer auto-opening behavior it got broken by hint label changes
push time in 7 days
push eventjedwards1211/breakout
commit sha 4a8ce98fc29e316bab2334eec779e0968387d9a1
feat: show trip date and surveyors in hint labels also make text smaller and make foreground/background respond to color pickers
push time in 7 days
pull request commentpfusik/cito
TypeScript declarations generator
I'm working a bit on this during spare time on my trip. Turns out TS does have errors for forward class references, so I'll have to implement a toposort. Is it okay if I implement toposort using depth-first search or would you prefer that I use an algorithm that doesn't risk stack overflow?
comment created time in 7 days
push eventjedwards1211/cito
commit sha cd9646814b52681405d13ad30d0283aa3673e534
implement full TS code generation [WIP]
push time in 7 days
push eventjedwards1211/breakout
commit sha 0bbcd11a7ad367b26a3e5609bd7a64bfc3ece6e0
chore: add package.sh script
commit sha 1b763ab9009b19bdde16e9e6c46df4664e88ff5e
fix: color by height/width etc
push time in 7 days
issue commentCavewhere/cavewhere
CaveWhere doesn't accept -0.0 or 360.0 values for shot azimuth
That's kinda annoying that DistoX generates those hah
comment created time in 7 days
issue commentCavewhere/cavewhere
I can't remember if there used to be a dropdown menu that would allow you to select up/down or if I just noticed they were a special case in the code?
comment created time in 7 days
issue openedCavewhere/cavewhere
Cavewhere thinks 1° and 359° are 358° apart, rather than 2° (when backsight is marked corrected)

Here are some angle functions I use. The fmod can be omitted if you don't expect the inputs to be outside the range [0, 360].
// returns rotation such that from + rotation = to (mod 360)
float rotationBetween(float from, float to) {
float raw = fmod((to - from), 360f);
return raw < -180f
? raw + 360f
: raw > 180f
? raw - 360f
: raw;
}
// more efficient version of fabs(rotationBetween(a, b))
float absAngleDifference(float a, float b) {
float raw = fmod(fabs(a - b), 360f);
return raw > 180f ? 360f - raw : raw;
}
created time in 7 days
issue closedCavewhere/cavewhere
Cavewhere thinks 1° and 359° are 178° apart, rather than 2°

Here are some angle functions I use. The fmod can be omitted if you don't expect the inputs to be outside the range [0, 360].
// returns rotation such that from + rotation = to (mod 360)
float rotationBetween(float from, float to) {
float raw = fmod((to - from), 360f);
return raw < -180f
? raw + 360f
: raw > 180f
? raw - 360f
: raw;
}
// more efficient version of fabs(rotationBetween(a, b))
float absAngleDifference(float a, float b) {
float raw = fmod(fabs(a, b), 360f);
return raw > 180f ? 360f - raw : raw;
}
closed time in 7 days
jedwards1211issue commentCavewhere/cavewhere
Cavewhere thinks 1° and 359° are 178° apart, rather than 2°
Whoops I hadn't marked corrected backsight, but, there's a separate issue in that case
comment created time in 7 days
issue openedCavewhere/cavewhere
I know that the error goes away if I use "Up"/"Down", but since the Compass import doesn't currently convert +/-90 to Up/Down, I'm questioning whether it's worth having special Up/Down constants...

created time in 7 days
issue openedCavewhere/cavewhere
After typing in a measurement in a data table, if I double-click it, backspace, and hit enter, the number remains instead of going away
created time in 7 days
issue openedCavewhere/cavewhere
Cavewhere thinks 1° and 359° are 178° apart, rather than 2°

Here are some angle functions I use. The fmod can be omitted if you don't expect the inputs to be outside the range [0, 360].
// returns rotation such that from + rotation = to (mod 360)
float rotationBetween(float from, float to) {
float raw = fmod((to - from), 360f);
return raw < -180f
? raw + 360f
: raw > 180f
? raw - 360f
: raw;
}
// more efficient version of fabs(rotationBetween(a, b))
float absAngleDifference(float a, float b) {
float raw = fmod(fabs(a, b), 360f);
return raw > 180f ? 360f - raw : raw;
}
created time in 7 days