What is the unit of geometry.volume() in CGA? For example if I extrude a footprint and report geometry.volume()...what is the unit of measurement returned? I feel like the numbers I get are way too big.
Solved! Go to Solution.
I just made an example of unit conversions for CGA, using a rule that can use both Feet or Meter input. It has a lot of comments that explain the code. It is not completely simple, so let me know if you need clarification on something.
The example has functions to convert inputs to meters for use in CGA. Once the inputs are converted to meters, then you don't have to worry about the geometry functions inside the rule or the output model.
So aside from converting feet to meters on the way in, if you want to output reports in feet or square feet, you must convert the values returned by CGA's geometry functions to feet on the way out. I've added two new functions for these reports this morning, so if you find an error let me know.
All of these functions do length and area, but you could follow the same pattern for volumes. If anyone feels like creating volume functions for this, please post it here and mention me, as I would want to add that into this example.
Chris
if the distance units are meters, then the units are probably meters cubed (m^3) since I doubt conversion to other scalings are done automatically...this would be the same if the distance units were feet
All units inside of CGA are in meters, regardless of scene units. The output of the rule will be in meters, and if your scene is in meters or feet, then model will be still be the correct size.
That means if you say extrude(10) and your scene is in feet, you still get a 10 meter high building put into the scene. If your scene is in meters, you also get a 10 meter high building.
If you use the geometry.area, you get meters^2. And geometry.volume gives meters^3 as Dan states. Translation and scaling are the same. Etc.
If you want to feed other units into CGA then do the conversion immediately after the input. I mean, don't do it down in the code or it may be more confusing. Example:
attr myBuildingHeightFeet = 100 # This attribute can be mapped to a field in your feature class.
const myBuildingHeightMeters = metersPerFeet * myBuildingHeightFeet
const metersPerFeet = 0.3048
And then use myBuildingHeightMeters when you extrude the building footprint. This example assumes your input must be in feet, so is not a good example. A better example would be when you must have a rule that can take both feet or meters. I've got some boilerplate unit conversion code that I use for this - I'll come back later and post an example.
Chris
I just made an example of unit conversions for CGA, using a rule that can use both Feet or Meter input. It has a lot of comments that explain the code. It is not completely simple, so let me know if you need clarification on something.
The example has functions to convert inputs to meters for use in CGA. Once the inputs are converted to meters, then you don't have to worry about the geometry functions inside the rule or the output model.
So aside from converting feet to meters on the way in, if you want to output reports in feet or square feet, you must convert the values returned by CGA's geometry functions to feet on the way out. I've added two new functions for these reports this morning, so if you find an error let me know.
All of these functions do length and area, but you could follow the same pattern for volumes. If anyone feels like creating volume functions for this, please post it here and mention me, as I would want to add that into this example.
Chris