scriptup 2026.0.1 → 2026.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (501) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -24
  3. data/ext/arc_curve.c +50 -0
  4. data/ext/attribute_dictionaries.c +49 -32
  5. data/ext/attribute_dictionary.c +54 -127
  6. data/ext/axes.c +79 -0
  7. data/ext/behavior.c +100 -9
  8. data/ext/bounding_box.c +195 -0
  9. data/ext/camera.c +178 -0
  10. data/ext/classifications.c +85 -0
  11. data/ext/color.c +91 -163
  12. data/ext/component_definition.c +78 -162
  13. data/ext/component_instance.c +88 -9
  14. data/ext/construction.c +59 -0
  15. data/ext/curve.c +87 -0
  16. data/ext/definition_list.c +89 -109
  17. data/ext/depend +1 -0
  18. data/ext/drawing_element.c +96 -117
  19. data/ext/edge.c +147 -0
  20. data/ext/edge_use.c +37 -0
  21. data/ext/entities.c +573 -16
  22. data/ext/entities_builder.c +145 -0
  23. data/ext/entity.c +175 -215
  24. data/ext/environments.c +149 -0
  25. data/ext/extconf.rb +54 -10
  26. data/ext/face.c +331 -0
  27. data/ext/geom.c +172 -0
  28. data/ext/group.c +86 -0
  29. data/ext/helpers.c +244 -0
  30. data/ext/image.c +182 -0
  31. data/ext/image_rep.c +158 -0
  32. data/ext/instance_path.c +185 -0
  33. data/ext/lat_long.c +88 -0
  34. data/ext/layer.c +98 -0
  35. data/ext/layer_folder.c +99 -0
  36. data/ext/layers.c +122 -0
  37. data/ext/length.c +253 -0
  38. data/ext/line_styles.c +60 -0
  39. data/ext/loop.c +24 -0
  40. data/ext/material.c +144 -197
  41. data/ext/materials.c +49 -60
  42. data/ext/model.c +232 -26
  43. data/ext/options_store.c +188 -0
  44. data/ext/page.c +168 -0
  45. data/ext/pages.c +135 -0
  46. data/ext/point2d.c +195 -0
  47. data/ext/point3d.c +340 -0
  48. data/ext/polygon_mesh.c +253 -0
  49. data/ext/scriptup.h +279 -0
  50. data/ext/section_plane.c +44 -0
  51. data/ext/sketchup.c +102 -76
  52. data/ext/styles.c +91 -0
  53. data/ext/text.c +135 -0
  54. data/ext/texture.c +74 -83
  55. data/ext/texture_writer.c +104 -0
  56. data/ext/transformation.c +309 -0
  57. data/ext/transformation2d.c +190 -0
  58. data/ext/uv_helper.c +41 -0
  59. data/ext/vector2d.c +238 -0
  60. data/ext/vector3d.c +294 -0
  61. data/ext/vertex.c +67 -0
  62. data/lib/sketchup.rb +2 -2
  63. data/sig/_top_level.rbs +188 -0
  64. data/sig/array.rbs +52 -0
  65. data/sig/geom/bounding_box.rbs +28 -0
  66. data/sig/geom/bounds2d.rbs +20 -0
  67. data/sig/geom/lat_long.rbs +13 -0
  68. data/sig/geom/oriented_bounds2d.rbs +10 -0
  69. data/sig/geom/point2d.rbs +32 -0
  70. data/sig/geom/point3d.rbs +46 -0
  71. data/sig/geom/polygon_mesh.rbs +35 -0
  72. data/sig/geom/transformation.rbs +44 -0
  73. data/sig/geom/transformation2d.rbs +26 -0
  74. data/sig/geom/utm.rbs +14 -0
  75. data/sig/geom/vector2d.rbs +40 -0
  76. data/sig/geom/vector3d.rbs +49 -0
  77. data/sig/geom.rbs +25 -0
  78. data/sig/language_handler.rbs +8 -0
  79. data/sig/layout/angular_dimension.rbs +32 -0
  80. data/sig/layout/auto_text_definition.rbs +73 -0
  81. data/sig/layout/auto_text_definitions.rbs +15 -0
  82. data/sig/layout/connection_point.rbs +6 -0
  83. data/sig/layout/dictionary.rbs +18 -0
  84. data/sig/layout/document.rbs +61 -0
  85. data/sig/layout/ellipse.rbs +5 -0
  86. data/sig/layout/entities.rbs +10 -0
  87. data/sig/layout/entity.rbs +28 -0
  88. data/sig/layout/formatted_text.rbs +30 -0
  89. data/sig/layout/grid.rbs +24 -0
  90. data/sig/layout/group.rbs +17 -0
  91. data/sig/layout/image.rbs +7 -0
  92. data/sig/layout/label.rbs +31 -0
  93. data/sig/layout/layer.rbs +21 -0
  94. data/sig/layout/layer_instance.rbs +9 -0
  95. data/sig/layout/layers.rbs +18 -0
  96. data/sig/layout/linear_dimension.rbs +39 -0
  97. data/sig/layout/locked_entity_error.rbs +4 -0
  98. data/sig/layout/locked_layer_error.rbs +4 -0
  99. data/sig/layout/page.rbs +20 -0
  100. data/sig/layout/page_info.rbs +37 -0
  101. data/sig/layout/pages.rbs +17 -0
  102. data/sig/layout/path.rbs +34 -0
  103. data/sig/layout/rectangle.rbs +15 -0
  104. data/sig/layout/reference_entity.rbs +7 -0
  105. data/sig/layout/sketch_up_model.rbs +54 -0
  106. data/sig/layout/style.rbs +150 -0
  107. data/sig/layout/table.rbs +17 -0
  108. data/sig/layout/table_cell.rbs +13 -0
  109. data/sig/layout/table_column.rbs +10 -0
  110. data/sig/layout/table_row.rbs +10 -0
  111. data/sig/layout.rbs +4 -0
  112. data/sig/length.rbs +37 -0
  113. data/sig/numeric.rbs +23 -0
  114. data/sig/sketchup/animation.rbs +8 -0
  115. data/sig/sketchup/app_observer.rbs +11 -0
  116. data/sig/sketchup/arc_curve.rbs +14 -0
  117. data/sig/sketchup/attribute_dictionaries.rbs +11 -0
  118. data/sig/sketchup/attribute_dictionary.rbs +18 -0
  119. data/sig/sketchup/axes.rbs +13 -0
  120. data/sig/sketchup/behavior.rbs +19 -0
  121. data/sig/sketchup/camera.rbs +33 -0
  122. data/sig/sketchup/classification_schema.rbs +8 -0
  123. data/sig/sketchup/classifications.rbs +12 -0
  124. data/sig/sketchup/color.rbs +22 -0
  125. data/sig/sketchup/component_definition.rbs +43 -0
  126. data/sig/sketchup/component_instance.rbs +32 -0
  127. data/sig/sketchup/console.rbs +8 -0
  128. data/sig/sketchup/construction_line.rbs +17 -0
  129. data/sig/sketchup/construction_point.rbs +5 -0
  130. data/sig/sketchup/curve.rbs +13 -0
  131. data/sig/sketchup/definition_list.rbs +26 -0
  132. data/sig/sketchup/definition_observer.rbs +6 -0
  133. data/sig/sketchup/definitions_observer.rbs +8 -0
  134. data/sig/sketchup/dimension.rbs +18 -0
  135. data/sig/sketchup/dimension_linear.rbs +24 -0
  136. data/sig/sketchup/dimension_observer.rbs +5 -0
  137. data/sig/sketchup/dimension_radial.rbs +9 -0
  138. data/sig/sketchup/drawingelement.rbs +18 -0
  139. data/sig/sketchup/edge.rbs +24 -0
  140. data/sig/sketchup/edge_use.rbs +13 -0
  141. data/sig/sketchup/entities.rbs +61 -0
  142. data/sig/sketchup/entities_builder.rbs +15 -0
  143. data/sig/sketchup/entities_observer.rbs +9 -0
  144. data/sig/sketchup/entity.rbs +21 -0
  145. data/sig/sketchup/entity_observer.rbs +6 -0
  146. data/sig/sketchup/environment.rbs +25 -0
  147. data/sig/sketchup/environments.rbs +18 -0
  148. data/sig/sketchup/environments_observer.rbs +8 -0
  149. data/sig/sketchup/extensions_manager.rbs +11 -0
  150. data/sig/sketchup/face.rbs +44 -0
  151. data/sig/sketchup/frame_change_observer.rbs +5 -0
  152. data/sig/sketchup/group.rbs +38 -0
  153. data/sig/sketchup/http/request.rbs +17 -0
  154. data/sig/sketchup/http/response.rbs +7 -0
  155. data/sig/sketchup/http.rbs +27 -0
  156. data/sig/sketchup/image.rbs +23 -0
  157. data/sig/sketchup/image_rep.rbs +17 -0
  158. data/sig/sketchup/importer.rbs +14 -0
  159. data/sig/sketchup/input_point.rbs +25 -0
  160. data/sig/sketchup/instance_observer.rbs +6 -0
  161. data/sig/sketchup/instance_path.rbs +20 -0
  162. data/sig/sketchup/layer.rbs +20 -0
  163. data/sig/sketchup/layer_folder.rbs +26 -0
  164. data/sig/sketchup/layers.rbs +30 -0
  165. data/sig/sketchup/layers_observer.rbs +13 -0
  166. data/sig/sketchup/licensing/extension_license.rbs +8 -0
  167. data/sig/sketchup/licensing.rbs +15 -0
  168. data/sig/sketchup/line_style.rbs +5 -0
  169. data/sig/sketchup/line_styles.rbs +13 -0
  170. data/sig/sketchup/load_handler.rbs +8 -0
  171. data/sig/sketchup/loop.rbs +10 -0
  172. data/sig/sketchup/material.rbs +74 -0
  173. data/sig/sketchup/materials.rbs +22 -0
  174. data/sig/sketchup/materials_observer.rbs +10 -0
  175. data/sig/sketchup/menu.rbs +9 -0
  176. data/sig/sketchup/model.rbs +105 -0
  177. data/sig/sketchup/model_observer.rbs +23 -0
  178. data/sig/sketchup/options_manager.rbs +12 -0
  179. data/sig/sketchup/options_provider.rbs +23 -0
  180. data/sig/sketchup/options_provider_observer.rbs +5 -0
  181. data/sig/sketchup/overlay.rbs +21 -0
  182. data/sig/sketchup/overlays_manager.rbs +10 -0
  183. data/sig/sketchup/page.rbs +55 -0
  184. data/sig/sketchup/pages.rbs +25 -0
  185. data/sig/sketchup/pages_observer.rbs +7 -0
  186. data/sig/sketchup/pick_helper.rbs +28 -0
  187. data/sig/sketchup/regional_settings.rbs +7 -0
  188. data/sig/sketchup/rendering_options.rbs +89 -0
  189. data/sig/sketchup/rendering_options_observer.rbs +5 -0
  190. data/sig/sketchup/section_plane.rbs +12 -0
  191. data/sig/sketchup/selection.rbs +31 -0
  192. data/sig/sketchup/selection_observer.rbs +8 -0
  193. data/sig/sketchup/set.rbs +15 -0
  194. data/sig/sketchup/shadow_info.rbs +18 -0
  195. data/sig/sketchup/shadow_info_observer.rbs +5 -0
  196. data/sig/sketchup/skp.rbs +5 -0
  197. data/sig/sketchup/snap.rbs +10 -0
  198. data/sig/sketchup/style.rbs +9 -0
  199. data/sig/sketchup/styles.rbs +21 -0
  200. data/sig/sketchup/text.rbs +22 -0
  201. data/sig/sketchup/texture.rbs +14 -0
  202. data/sig/sketchup/texture_writer.rbs +14 -0
  203. data/sig/sketchup/tool.rbs +45 -0
  204. data/sig/sketchup/tools.rbs +14 -0
  205. data/sig/sketchup/tools_observer.rbs +6 -0
  206. data/sig/sketchup/uv_helper.rbs +6 -0
  207. data/sig/sketchup/vertex.rbs +11 -0
  208. data/sig/sketchup/view.rbs +87 -0
  209. data/sig/sketchup/view_observer.rbs +6 -0
  210. data/sig/sketchup.rbs +137 -0
  211. data/sig/sketchup_extension.rbs +23 -0
  212. data/sig/string.rbs +5 -0
  213. data/sig/ui/command.rbs +20 -0
  214. data/sig/ui/html_dialog.rbs +29 -0
  215. data/sig/ui/notification.rbs +16 -0
  216. data/sig/ui/toolbar.rbs +18 -0
  217. data/sig/ui/web_dialog.rbs +38 -0
  218. data/sig/ui.rbs +66 -0
  219. metadata +204 -287
  220. data/ext/attribute_dictionaries.h +0 -8
  221. data/ext/attribute_dictionary.h +0 -8
  222. data/ext/behavior.h +0 -8
  223. data/ext/color.h +0 -8
  224. data/ext/component_definition.h +0 -8
  225. data/ext/component_instance.h +0 -8
  226. data/ext/definition_list.h +0 -8
  227. data/ext/drawing_element.h +0 -8
  228. data/ext/entities.h +0 -8
  229. data/ext/entity.h +0 -8
  230. data/ext/material.h +0 -8
  231. data/ext/materials.h +0 -8
  232. data/ext/model.h +0 -8
  233. data/ext/not_implemented.c +0 -88
  234. data/ext/not_implemented.h +0 -20
  235. data/ext/sketchup.h +0 -9
  236. data/ext/texture.h +0 -8
  237. data/ext/typed_value.c +0 -84
  238. data/ext/typed_value.h +0 -11
  239. data/ext/utils.h +0 -111
  240. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonGeometry.dylib +0 -0
  241. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonGeoutils.dylib +0 -0
  242. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonImage.dylib +0 -4
  243. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonPreferences.dylib +0 -0
  244. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonUnits.dylib +0 -0
  245. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonUtils.dylib +0 -0
  246. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonZip.dylib +0 -0
  247. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/application.h +0 -36
  248. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/model.h +0 -59
  249. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/overlay.h +0 -262
  250. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/ruby_api.h +0 -118
  251. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/color.h +0 -107
  252. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/common.h +0 -178
  253. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/defs.h +0 -19
  254. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/extension_license.h +0 -70
  255. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/bounding_box.h +0 -34
  256. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/plane3d.h +0 -153
  257. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point2d.h +0 -96
  258. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point3d.h +0 -98
  259. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/ray3d.h +0 -64
  260. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation.h +0 -321
  261. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation2d.h +0 -163
  262. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector2d.h +0 -235
  263. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector3d.h +0 -285
  264. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry.h +0 -154
  265. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelexporterplugin.h +0 -165
  266. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelimporterplugin.h +0 -187
  267. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/pluginprogresscallback.h +0 -84
  268. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/initialize.h +0 -43
  269. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/length_formatter.h +0 -424
  270. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arccurve.h +0 -244
  271. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arrow_type.h +0 -17
  272. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/attribute_dictionary.h +0 -161
  273. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/axes.h +0 -242
  274. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/camera.h +0 -398
  275. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_attribute.h +0 -89
  276. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_info.h +0 -125
  277. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classifications.h +0 -86
  278. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition.h +0 -629
  279. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition_snap_to_behavior_private.h +0 -46
  280. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_instance.h +0 -344
  281. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/curve.h +0 -143
  282. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/defs.h +0 -147
  283. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension.h +0 -224
  284. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_linear.h +0 -421
  285. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_radial.h +0 -194
  286. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_style.h +0 -253
  287. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/drawing_element.h +0 -198
  288. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_attribute.h +0 -92
  289. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_info.h +0 -70
  290. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge.h +0 -271
  291. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge_use.h +0 -214
  292. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entities.h +0 -879
  293. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity.h +0 -189
  294. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list.h +0 -80
  295. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list_iterator.h +0 -90
  296. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/environment.h +0 -382
  297. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/environments.h +0 -133
  298. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/face.h +0 -702
  299. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/font.h +0 -138
  300. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry.h +0 -20
  301. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry_input.h +0 -695
  302. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/group.h +0 -245
  303. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_line.h +0 -155
  304. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_point.h +0 -153
  305. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image.h +0 -289
  306. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image_rep.h +0 -275
  307. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/instancepath.h +0 -266
  308. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer.h +0 -265
  309. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer_folder.h +0 -301
  310. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_style.h +0 -211
  311. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_styles.h +0 -81
  312. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/location.h +0 -65
  313. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/loop.h +0 -182
  314. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/material.h +0 -797
  315. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/mesh_helper.h +0 -187
  316. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model.h +0 -1826
  317. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_entity_type_private.h +0 -44
  318. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_version.h +0 -49
  319. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/opening.h +0 -72
  320. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_manager.h +0 -79
  321. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_provider.h +0 -166
  322. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/polyline3d.h +0 -140
  323. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/rendering_options.h +0 -180
  324. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/scene.h +0 -1016
  325. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema.h +0 -56
  326. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema_type.h +0 -26
  327. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/section_plane.h +0 -212
  328. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/selection.h +0 -156
  329. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/shadow_info.h +0 -147
  330. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/skp.h +0 -45
  331. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/snap.h +0 -183
  332. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/space.h +0 -26
  333. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/style.h +0 -303
  334. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/styles.h +0 -192
  335. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/text.h +0 -392
  336. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture.h +0 -380
  337. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture_writer.h +0 -280
  338. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/typed_value.h +0 -390
  339. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/uv_helper.h +0 -79
  340. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/vertex.h +0 -154
  341. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup.h +0 -125
  342. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup_info.h +0 -65
  343. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/slapi.h +0 -16
  344. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/transformation.h +0 -16
  345. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/unicodestring.h +0 -239
  346. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/utils/math_helpers.h +0 -124
  347. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Resources/Info.plist +0 -50
  348. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/SketchUpAPI +0 -0
  349. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/_CodeSignature/CodeResources +0 -891
  350. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.dll +0 -0
  351. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.lib +0 -0
  352. data/sketchup-sdk-win/binaries/layout/x64/LayOutControllers.dll +0 -0
  353. data/sketchup-sdk-win/binaries/layout/x64/LayOutModel.dll +0 -0
  354. data/sketchup-sdk-win/binaries/layout/x64/LayOutRTF.dll +0 -0
  355. data/sketchup-sdk-win/binaries/layout/x64/LayOutUtils.dll +0 -0
  356. data/sketchup-sdk-win/binaries/layout/x64/LayOutView.dll +0 -4
  357. data/sketchup-sdk-win/binaries/layout/x64/SketchUpCommonPreferences.dll +0 -0
  358. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.dll +0 -0
  359. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.lib +0 -0
  360. data/sketchup-sdk-win/binaries/layout/x64/pdflib.dll +0 -0
  361. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.dll +0 -0
  362. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.lib +0 -0
  363. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpCommonPreferences.dll +0 -0
  364. data/sketchup-sdk-win/binaries/sketchup/x64/sketchup.lib +0 -0
  365. data/sketchup-sdk-win/headers/LayOutAPI/application/application.h +0 -117
  366. data/sketchup-sdk-win/headers/LayOutAPI/common.h +0 -22
  367. data/sketchup-sdk-win/headers/LayOutAPI/geometry/geometry.h +0 -78
  368. data/sketchup-sdk-win/headers/LayOutAPI/initialize.h +0 -36
  369. data/sketchup-sdk-win/headers/LayOutAPI/layout.h +0 -49
  370. data/sketchup-sdk-win/headers/LayOutAPI/model/angulardimension.h +0 -468
  371. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinition.h +0 -569
  372. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinitionlist.h +0 -79
  373. data/sketchup-sdk-win/headers/LayOutAPI/model/connectionpoint.h +0 -107
  374. data/sketchup-sdk-win/headers/LayOutAPI/model/defs.h +0 -42
  375. data/sketchup-sdk-win/headers/LayOutAPI/model/dictionary.h +0 -120
  376. data/sketchup-sdk-win/headers/LayOutAPI/model/document.h +0 -937
  377. data/sketchup-sdk-win/headers/LayOutAPI/model/documentexportoptions.h +0 -78
  378. data/sketchup-sdk-win/headers/LayOutAPI/model/ellipse.h +0 -78
  379. data/sketchup-sdk-win/headers/LayOutAPI/model/entity.h +0 -402
  380. data/sketchup-sdk-win/headers/LayOutAPI/model/entityiterator.h +0 -49
  381. data/sketchup-sdk-win/headers/LayOutAPI/model/entitylist.h +0 -114
  382. data/sketchup-sdk-win/headers/LayOutAPI/model/formattedtext.h +0 -397
  383. data/sketchup-sdk-win/headers/LayOutAPI/model/grid.h +0 -251
  384. data/sketchup-sdk-win/headers/LayOutAPI/model/group.h +0 -244
  385. data/sketchup-sdk-win/headers/LayOutAPI/model/image.h +0 -146
  386. data/sketchup-sdk-win/headers/LayOutAPI/model/imagerep.h +0 -109
  387. data/sketchup-sdk-win/headers/LayOutAPI/model/label.h +0 -332
  388. data/sketchup-sdk-win/headers/LayOutAPI/model/layer.h +0 -207
  389. data/sketchup-sdk-win/headers/LayOutAPI/model/layerinstance.h +0 -117
  390. data/sketchup-sdk-win/headers/LayOutAPI/model/layerlist.h +0 -69
  391. data/sketchup-sdk-win/headers/LayOutAPI/model/lineardimension.h +0 -508
  392. data/sketchup-sdk-win/headers/LayOutAPI/model/page.h +0 -331
  393. data/sketchup-sdk-win/headers/LayOutAPI/model/pageinfo.h +0 -372
  394. data/sketchup-sdk-win/headers/LayOutAPI/model/pagelist.h +0 -81
  395. data/sketchup-sdk-win/headers/LayOutAPI/model/path.h +0 -464
  396. data/sketchup-sdk-win/headers/LayOutAPI/model/rectangle.h +0 -240
  397. data/sketchup-sdk-win/headers/LayOutAPI/model/referenceentity.h +0 -120
  398. data/sketchup-sdk-win/headers/LayOutAPI/model/sketchupmodel.h +0 -681
  399. data/sketchup-sdk-win/headers/LayOutAPI/model/style.h +0 -1116
  400. data/sketchup-sdk-win/headers/LayOutAPI/model/table.h +0 -472
  401. data/sketchup-sdk-win/headers/LayOutAPI/model/typed_value.h +0 -180
  402. data/sketchup-sdk-win/headers/SketchUpAPI/application/application.h +0 -36
  403. data/sketchup-sdk-win/headers/SketchUpAPI/application/model.h +0 -59
  404. data/sketchup-sdk-win/headers/SketchUpAPI/application/overlay.h +0 -262
  405. data/sketchup-sdk-win/headers/SketchUpAPI/application/ruby_api.h +0 -118
  406. data/sketchup-sdk-win/headers/SketchUpAPI/color.h +0 -107
  407. data/sketchup-sdk-win/headers/SketchUpAPI/common.h +0 -178
  408. data/sketchup-sdk-win/headers/SketchUpAPI/defs.h +0 -19
  409. data/sketchup-sdk-win/headers/SketchUpAPI/extension_license.h +0 -70
  410. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/bounding_box.h +0 -34
  411. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/plane3d.h +0 -153
  412. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point2d.h +0 -96
  413. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point3d.h +0 -98
  414. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/ray3d.h +0 -64
  415. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation.h +0 -321
  416. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation2d.h +0 -163
  417. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector2d.h +0 -235
  418. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector3d.h +0 -285
  419. data/sketchup-sdk-win/headers/SketchUpAPI/geometry.h +0 -154
  420. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelexporterplugin.h +0 -165
  421. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelimporterplugin.h +0 -187
  422. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/pluginprogresscallback.h +0 -84
  423. data/sketchup-sdk-win/headers/SketchUpAPI/initialize.h +0 -43
  424. data/sketchup-sdk-win/headers/SketchUpAPI/length_formatter.h +0 -424
  425. data/sketchup-sdk-win/headers/SketchUpAPI/model/arccurve.h +0 -244
  426. data/sketchup-sdk-win/headers/SketchUpAPI/model/arrow_type.h +0 -17
  427. data/sketchup-sdk-win/headers/SketchUpAPI/model/attribute_dictionary.h +0 -161
  428. data/sketchup-sdk-win/headers/SketchUpAPI/model/axes.h +0 -242
  429. data/sketchup-sdk-win/headers/SketchUpAPI/model/camera.h +0 -398
  430. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_attribute.h +0 -89
  431. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_info.h +0 -125
  432. data/sketchup-sdk-win/headers/SketchUpAPI/model/classifications.h +0 -86
  433. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition.h +0 -629
  434. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition_snap_to_behavior_private.h +0 -46
  435. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_instance.h +0 -344
  436. data/sketchup-sdk-win/headers/SketchUpAPI/model/curve.h +0 -143
  437. data/sketchup-sdk-win/headers/SketchUpAPI/model/defs.h +0 -147
  438. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension.h +0 -224
  439. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_linear.h +0 -421
  440. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_radial.h +0 -194
  441. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_style.h +0 -253
  442. data/sketchup-sdk-win/headers/SketchUpAPI/model/drawing_element.h +0 -198
  443. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_attribute.h +0 -92
  444. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_info.h +0 -70
  445. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge.h +0 -271
  446. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge_use.h +0 -214
  447. data/sketchup-sdk-win/headers/SketchUpAPI/model/entities.h +0 -879
  448. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity.h +0 -189
  449. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list.h +0 -80
  450. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list_iterator.h +0 -90
  451. data/sketchup-sdk-win/headers/SketchUpAPI/model/environment.h +0 -382
  452. data/sketchup-sdk-win/headers/SketchUpAPI/model/environments.h +0 -133
  453. data/sketchup-sdk-win/headers/SketchUpAPI/model/face.h +0 -702
  454. data/sketchup-sdk-win/headers/SketchUpAPI/model/font.h +0 -138
  455. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry.h +0 -20
  456. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry_input.h +0 -695
  457. data/sketchup-sdk-win/headers/SketchUpAPI/model/group.h +0 -245
  458. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_line.h +0 -155
  459. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_point.h +0 -153
  460. data/sketchup-sdk-win/headers/SketchUpAPI/model/image.h +0 -289
  461. data/sketchup-sdk-win/headers/SketchUpAPI/model/image_rep.h +0 -275
  462. data/sketchup-sdk-win/headers/SketchUpAPI/model/instancepath.h +0 -266
  463. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer.h +0 -265
  464. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer_folder.h +0 -301
  465. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_style.h +0 -211
  466. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_styles.h +0 -81
  467. data/sketchup-sdk-win/headers/SketchUpAPI/model/location.h +0 -65
  468. data/sketchup-sdk-win/headers/SketchUpAPI/model/loop.h +0 -182
  469. data/sketchup-sdk-win/headers/SketchUpAPI/model/material.h +0 -797
  470. data/sketchup-sdk-win/headers/SketchUpAPI/model/mesh_helper.h +0 -187
  471. data/sketchup-sdk-win/headers/SketchUpAPI/model/model.h +0 -1826
  472. data/sketchup-sdk-win/headers/SketchUpAPI/model/model_entity_type_private.h +0 -44
  473. data/sketchup-sdk-win/headers/SketchUpAPI/model/model_version.h +0 -49
  474. data/sketchup-sdk-win/headers/SketchUpAPI/model/opening.h +0 -72
  475. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_manager.h +0 -79
  476. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_provider.h +0 -166
  477. data/sketchup-sdk-win/headers/SketchUpAPI/model/polyline3d.h +0 -140
  478. data/sketchup-sdk-win/headers/SketchUpAPI/model/rendering_options.h +0 -180
  479. data/sketchup-sdk-win/headers/SketchUpAPI/model/scene.h +0 -1016
  480. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema.h +0 -56
  481. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema_type.h +0 -26
  482. data/sketchup-sdk-win/headers/SketchUpAPI/model/section_plane.h +0 -212
  483. data/sketchup-sdk-win/headers/SketchUpAPI/model/selection.h +0 -156
  484. data/sketchup-sdk-win/headers/SketchUpAPI/model/shadow_info.h +0 -147
  485. data/sketchup-sdk-win/headers/SketchUpAPI/model/skp.h +0 -45
  486. data/sketchup-sdk-win/headers/SketchUpAPI/model/snap.h +0 -183
  487. data/sketchup-sdk-win/headers/SketchUpAPI/model/space.h +0 -26
  488. data/sketchup-sdk-win/headers/SketchUpAPI/model/style.h +0 -303
  489. data/sketchup-sdk-win/headers/SketchUpAPI/model/styles.h +0 -192
  490. data/sketchup-sdk-win/headers/SketchUpAPI/model/text.h +0 -392
  491. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture.h +0 -380
  492. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture_writer.h +0 -280
  493. data/sketchup-sdk-win/headers/SketchUpAPI/model/typed_value.h +0 -390
  494. data/sketchup-sdk-win/headers/SketchUpAPI/model/uv_helper.h +0 -79
  495. data/sketchup-sdk-win/headers/SketchUpAPI/model/vertex.h +0 -154
  496. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup.h +0 -125
  497. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup_info.h +0 -65
  498. data/sketchup-sdk-win/headers/SketchUpAPI/slapi.h +0 -16
  499. data/sketchup-sdk-win/headers/SketchUpAPI/transformation.h +0 -16
  500. data/sketchup-sdk-win/headers/SketchUpAPI/unicodestring.h +0 -239
  501. data/sketchup-sdk-win/headers/SketchUpAPI/utils/math_helpers.h +0 -124
@@ -0,0 +1,195 @@
1
+ #include <scriptup.h>
2
+ #include <float.h>
3
+
4
+ #define BB(obj) ((struct SUBoundingBox3D*)DATA_PTR(obj))
5
+
6
+ // An empty box has min > max.
7
+ static const struct SUBoundingBox3D empty_box = {{DBL_MAX, DBL_MAX, DBL_MAX}, {-DBL_MAX, -DBL_MAX, -DBL_MAX}};
8
+
9
+ static bool box_empty(const struct SUBoundingBox3D* b)
10
+ {
11
+ return b->min_point.x > b->max_point.x || b->min_point.y > b->max_point.y || b->min_point.z > b->max_point.z;
12
+ }
13
+
14
+ static VALUE boundingbox_alloc(VALUE klass)
15
+ {
16
+ struct SUBoundingBox3D* b;
17
+ VALUE obj = Data_Make_Struct(klass, struct SUBoundingBox3D, 0, RUBY_DEFAULT_FREE, b);
18
+ *b = empty_box;
19
+ return obj;
20
+ }
21
+
22
+ VALUE su_bounding_box_new(struct SUBoundingBox3D value)
23
+ {
24
+ VALUE obj = boundingbox_alloc(cBoundingBox);
25
+ *BB(obj) = value;
26
+ return obj;
27
+ }
28
+
29
+ static void box_add_point(struct SUBoundingBox3D* b, struct SUPoint3D p)
30
+ {
31
+ b->min_point.x = fmin(b->min_point.x, p.x);
32
+ b->min_point.y = fmin(b->min_point.y, p.y);
33
+ b->min_point.z = fmin(b->min_point.z, p.z);
34
+ b->max_point.x = fmax(b->max_point.x, p.x);
35
+ b->max_point.y = fmax(b->max_point.y, p.y);
36
+ b->max_point.z = fmax(b->max_point.z, p.z);
37
+ }
38
+
39
+ static void box_add(struct SUBoundingBox3D* b, VALUE item)
40
+ {
41
+ if (rb_obj_is_kind_of(item, cBoundingBox))
42
+ {
43
+ if (!box_empty(BB(item)))
44
+ {
45
+ box_add_point(b, BB(item)->min_point);
46
+ box_add_point(b, BB(item)->max_point);
47
+ }
48
+ }
49
+ else if (RB_TYPE_P(item, T_ARRAY) && RARRAY_LEN(item) > 0 && !rb_obj_is_kind_of(RARRAY_AREF(item, 0), rb_cNumeric))
50
+ {
51
+ for (long i = 0; i < RARRAY_LEN(item); i++)
52
+ box_add(b, RARRAY_AREF(item, i));
53
+ }
54
+ else
55
+ box_add_point(b, su_to_point3d(item));
56
+ }
57
+
58
+ static VALUE boundingbox_initialize(VALUE self)
59
+ {
60
+ return self;
61
+ }
62
+
63
+ static VALUE boundingbox_initialize_copy(VALUE self, VALUE other)
64
+ {
65
+ *BB(self) = *BB(other);
66
+ return self;
67
+ }
68
+
69
+ static VALUE boundingbox_add(int argc, VALUE* argv, VALUE self)
70
+ {
71
+ rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
72
+ for (int i = 0; i < argc; i++)
73
+ box_add(BB(self), argv[i]);
74
+ return self;
75
+ }
76
+
77
+ static VALUE boundingbox_clear(VALUE self)
78
+ {
79
+ *BB(self) = empty_box;
80
+ return self;
81
+ }
82
+
83
+ static VALUE boundingbox_empty_p(VALUE self)
84
+ {
85
+ return BOOL2RB(box_empty(BB(self)));
86
+ }
87
+
88
+ static VALUE boundingbox_valid_p(VALUE self)
89
+ {
90
+ return BOOL2RB(!box_empty(BB(self)));
91
+ }
92
+
93
+ static VALUE boundingbox_min(VALUE self)
94
+ {
95
+ return su_point3d_new(BB(self)->min_point);
96
+ }
97
+
98
+ static VALUE boundingbox_max(VALUE self)
99
+ {
100
+ return su_point3d_new(BB(self)->max_point);
101
+ }
102
+
103
+ static VALUE boundingbox_center(VALUE self)
104
+ {
105
+ struct SUPoint3D mid = {0, 0, 0};
106
+ if (!box_empty(BB(self)))
107
+ SUBoundingBox3DGetMidPoint(BB(self), &mid);
108
+ return su_point3d_new(mid);
109
+ }
110
+
111
+ static double extent(VALUE self, int axis)
112
+ {
113
+ struct SUBoundingBox3D* b = BB(self);
114
+ if (box_empty(b))
115
+ return 0.0;
116
+ double lo[3] = {b->min_point.x, b->min_point.y, b->min_point.z};
117
+ double hi[3] = {b->max_point.x, b->max_point.y, b->max_point.z};
118
+ return hi[axis] - lo[axis];
119
+ }
120
+
121
+ static VALUE boundingbox_width(VALUE self) { return su_length_new(extent(self, 0)); }
122
+ static VALUE boundingbox_height(VALUE self) { return su_length_new(extent(self, 1)); }
123
+ static VALUE boundingbox_depth(VALUE self) { return su_length_new(extent(self, 2)); }
124
+
125
+ static VALUE boundingbox_diagonal(VALUE self)
126
+ {
127
+ double x = extent(self, 0);
128
+ double y = extent(self, 1);
129
+ double z = extent(self, 2);
130
+ return su_length_new(sqrt(x * x + y * y + z * z));
131
+ }
132
+
133
+ static VALUE boundingbox_corner(VALUE self, VALUE index)
134
+ {
135
+ int i = NUM2INT(index);
136
+ if (i < 0 || i > 7)
137
+ rb_raise(rb_eIndexError, "corner index %d out of range [0, 7]", i);
138
+ struct SUBoundingBox3D* b = BB(self);
139
+ return su_point3d_new((struct SUPoint3D){
140
+ (i & 1) ? b->max_point.x : b->min_point.x,
141
+ (i & 2) ? b->max_point.y : b->min_point.y,
142
+ (i & 4) ? b->max_point.z : b->min_point.z});
143
+ }
144
+
145
+ static bool point_inside(const struct SUBoundingBox3D* b, struct SUPoint3D p)
146
+ {
147
+ return p.x >= b->min_point.x && p.x <= b->max_point.x && p.y >= b->min_point.y && p.y <= b->max_point.y &&
148
+ p.z >= b->min_point.z && p.z <= b->max_point.z;
149
+ }
150
+
151
+ static VALUE boundingbox_contains_p(VALUE self, VALUE other)
152
+ {
153
+ struct SUBoundingBox3D* b = BB(self);
154
+ if (box_empty(b))
155
+ return Qfalse;
156
+ if (rb_obj_is_kind_of(other, cBoundingBox))
157
+ return BOOL2RB(!box_empty(BB(other)) && point_inside(b, BB(other)->min_point) && point_inside(b, BB(other)->max_point));
158
+ return BOOL2RB(point_inside(b, su_to_point3d(other)));
159
+ }
160
+
161
+ static VALUE boundingbox_intersect(VALUE self, VALUE other)
162
+ {
163
+ struct SUBoundingBox3D* a = BB(self);
164
+ struct SUBoundingBox3D* b = su_unwrap(other, cBoundingBox);
165
+ struct SUBoundingBox3D result = {
166
+ {fmax(a->min_point.x, b->min_point.x), fmax(a->min_point.y, b->min_point.y), fmax(a->min_point.z, b->min_point.z)},
167
+ {fmin(a->max_point.x, b->max_point.x), fmin(a->max_point.y, b->max_point.y), fmin(a->max_point.z, b->max_point.z)}};
168
+ return su_bounding_box_new(box_empty(&result) ? empty_box : result);
169
+ }
170
+
171
+ void Init_bounding_box(void)
172
+ {
173
+ static const char* corners[8] = {"CORNER_LEFT_FRONT_BOTTOM", "CORNER_RIGHT_FRONT_BOTTOM", "CORNER_LEFT_BACK_BOTTOM",
174
+ "CORNER_RIGHT_BACK_BOTTOM", "CORNER_LEFT_FRONT_TOP", "CORNER_RIGHT_FRONT_TOP", "CORNER_LEFT_BACK_TOP",
175
+ "CORNER_RIGHT_BACK_TOP"};
176
+ for (int i = 0; i < 8; i++)
177
+ rb_define_const(cBoundingBox, corners[i], INT2FIX(i));
178
+ rb_define_alloc_func(cBoundingBox, boundingbox_alloc);
179
+ rb_define_method(cBoundingBox, "initialize", boundingbox_initialize, 0);
180
+ rb_define_method(cBoundingBox, "initialize_copy", boundingbox_initialize_copy, 1);
181
+ rb_define_method(cBoundingBox, "add", boundingbox_add, -1);
182
+ rb_define_method(cBoundingBox, "clear", boundingbox_clear, 0);
183
+ rb_define_method(cBoundingBox, "empty?", boundingbox_empty_p, 0);
184
+ rb_define_method(cBoundingBox, "valid?", boundingbox_valid_p, 0);
185
+ rb_define_method(cBoundingBox, "min", boundingbox_min, 0);
186
+ rb_define_method(cBoundingBox, "max", boundingbox_max, 0);
187
+ rb_define_method(cBoundingBox, "center", boundingbox_center, 0);
188
+ rb_define_method(cBoundingBox, "width", boundingbox_width, 0);
189
+ rb_define_method(cBoundingBox, "height", boundingbox_height, 0);
190
+ rb_define_method(cBoundingBox, "depth", boundingbox_depth, 0);
191
+ rb_define_method(cBoundingBox, "diagonal", boundingbox_diagonal, 0);
192
+ rb_define_method(cBoundingBox, "corner", boundingbox_corner, 1);
193
+ rb_define_method(cBoundingBox, "contains?", boundingbox_contains_p, 1);
194
+ rb_define_method(cBoundingBox, "intersect", boundingbox_intersect, 1);
195
+ }
data/ext/camera.c ADDED
@@ -0,0 +1,178 @@
1
+ #include <scriptup.h>
2
+
3
+ #define CAMERA(self) SU_REF(SUCameraRef, self)
4
+
5
+ static void camera_free(void* ptr)
6
+ {
7
+ SUCameraRef camera = {ptr};
8
+ if (ptr)
9
+ SUCameraRelease(&camera);
10
+ }
11
+
12
+ static VALUE camera_alloc(VALUE klass)
13
+ {
14
+ SUCameraRef camera = SU_INVALID;
15
+ SUCameraCreate(&camera);
16
+ return Data_Wrap_Struct(klass, 0, camera_free, camera.ptr);
17
+ }
18
+
19
+ // Wraps a camera owned by the model or a page.
20
+ VALUE su_camera_wrap(SUCameraRef camera)
21
+ {
22
+ return su_wrap_or_nil(cCamera, camera.ptr);
23
+ }
24
+
25
+ struct orientation
26
+ {
27
+ struct SUPoint3D eye;
28
+ struct SUPoint3D target;
29
+ struct SUVector3D up;
30
+ };
31
+
32
+ static struct orientation camera_orientation(VALUE self)
33
+ {
34
+ struct orientation o = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
35
+ SUCameraGetOrientation(CAMERA(self), &o.eye, &o.target, &o.up);
36
+ return o;
37
+ }
38
+
39
+ static VALUE camera_set(VALUE self, VALUE eye, VALUE target, VALUE up)
40
+ {
41
+ struct SUPoint3D e = su_to_point3d(eye);
42
+ struct SUPoint3D t = su_to_point3d(target);
43
+ struct SUVector3D u = su_to_vector3d(up);
44
+ bool same = false;
45
+ SUPoint3DGetEqual(&e, &t, &same);
46
+ if (same)
47
+ rb_raise(rb_eArgError, "eye and target must differ");
48
+ if (SUCameraSetOrientation(CAMERA(self), &e, &t, &u) != SU_ERROR_NONE)
49
+ rb_raise(rb_eArgError, "invalid camera orientation");
50
+ return self;
51
+ }
52
+
53
+ static VALUE camera_initialize(int argc, VALUE* argv, VALUE self)
54
+ {
55
+ VALUE eye, target, up, perspective, fov;
56
+ rb_scan_args(argc, argv, "05", &eye, &target, &up, &perspective, &fov);
57
+ if (argc == 0)
58
+ return self;
59
+ if (argc < 3)
60
+ rb_raise(rb_eArgError, "wrong number of arguments (given %d, expected 0 or 3..5)", argc);
61
+ camera_set(self, eye, target, up);
62
+ SUCameraSetPerspective(CAMERA(self), NIL_P(perspective) || RTEST(perspective));
63
+ if (!NIL_P(fov))
64
+ SUCameraSetPerspectiveFrustumFOV(CAMERA(self), NUM2DBL(fov));
65
+ return self;
66
+ }
67
+
68
+ static VALUE camera_eye(VALUE self) { return su_point3d_new(camera_orientation(self).eye); }
69
+ static VALUE camera_target(VALUE self) { return su_point3d_new(camera_orientation(self).target); }
70
+ static VALUE camera_up(VALUE self) { return su_vector3d_new(camera_orientation(self).up); }
71
+
72
+ static VALUE camera_direction(VALUE self)
73
+ {
74
+ struct SUVector3D v = {0, 0, 0};
75
+ SUCameraGetDirection(CAMERA(self), &v);
76
+ return su_vector3d_new(v);
77
+ }
78
+
79
+ // Camera space: z along the view direction, y up, x to the right.
80
+ static VALUE camera_zaxis(VALUE self) { return camera_direction(self); }
81
+
82
+ static VALUE camera_xaxis(VALUE self)
83
+ {
84
+ struct SUVector3D z = {0, 0, 0};
85
+ SUCameraGetDirection(CAMERA(self), &z);
86
+ struct SUVector3D up = camera_orientation(self).up;
87
+ struct SUVector3D x;
88
+ SUVector3DCross(&z, &up, &x);
89
+ SUVector3DNormalize(&x);
90
+ return su_vector3d_new(x);
91
+ }
92
+
93
+ static VALUE camera_yaxis(VALUE self)
94
+ {
95
+ struct SUVector3D z = {0, 0, 0};
96
+ SUCameraGetDirection(CAMERA(self), &z);
97
+ struct SUVector3D x = su_to_vector3d(camera_xaxis(self));
98
+ struct SUVector3D y;
99
+ SUVector3DCross(&x, &z, &y);
100
+ SUVector3DNormalize(&y);
101
+ return su_vector3d_new(y);
102
+ }
103
+
104
+ DEFINE_STRING_GETTER(camera_description, SUCameraRef, SUCameraGetDescription)
105
+ DEFINE_STRING_SETTER(camera_set_description, SUCameraRef, SUCameraSetDescription)
106
+ DEFINE_DOUBLE_GETTER(camera_fov, SUCameraRef, SUCameraGetPerspectiveFrustumFOV)
107
+ DEFINE_SETTER(camera_set_fov, SUCameraRef, SUCameraSetPerspectiveFrustumFOV, NUM2DBL)
108
+ DEFINE_DOUBLE_GETTER(camera_aspect_ratio, SUCameraRef, SUCameraGetAspectRatio)
109
+ DEFINE_SETTER(camera_set_aspect_ratio, SUCameraRef, SUCameraSetAspectRatio, NUM2DBL)
110
+ DEFINE_DOUBLE_GETTER(camera_height, SUCameraRef, SUCameraGetOrthographicFrustumHeight)
111
+ DEFINE_SETTER(camera_set_height, SUCameraRef, SUCameraSetOrthographicFrustumHeight, NUM2DBL)
112
+ DEFINE_DOUBLE_GETTER(camera_image_width, SUCameraRef, SUCameraGetImageWidth)
113
+ DEFINE_SETTER(camera_set_image_width, SUCameraRef, SUCameraSetImageWidth, NUM2DBL)
114
+ DEFINE_BOOL_GETTER(camera_perspective_p, SUCameraRef, SUCameraGetPerspective)
115
+ DEFINE_BOOL_SETTER(camera_set_perspective, SUCameraRef, SUCameraSetPerspective)
116
+ DEFINE_BOOL_GETTER(camera_fov_is_height_p, SUCameraRef, SUCameraGetFOVIsHeight)
117
+ DEFINE_BOOL_GETTER(camera_is_2d_p, SUCameraRef, SUCameraGet2D)
118
+ DEFINE_DOUBLE_GETTER(camera_scale_2d, SUCameraRef, SUCameraGetScale2D)
119
+
120
+ static VALUE camera_center_2d(VALUE self)
121
+ {
122
+ struct SUPoint3D center = {0, 0, 0};
123
+ SUCameraGetCenter2D(CAMERA(self), &center);
124
+ return su_point3d_new(center);
125
+ }
126
+
127
+ // Focal length in millimeters, from the field of view and image width.
128
+ static VALUE camera_focal_length(VALUE self)
129
+ {
130
+ double fov = 0.0;
131
+ double width = 0.0;
132
+ SUCameraGetPerspectiveFrustumFOV(CAMERA(self), &fov);
133
+ SUCameraGetImageWidth(CAMERA(self), &width);
134
+ return DBL2NUM(width / (2.0 * tan(fov * M_PI / 360.0)));
135
+ }
136
+
137
+ static VALUE camera_set_focal_length(VALUE self, VALUE focal_length)
138
+ {
139
+ double f = NUM2DBL(focal_length);
140
+ if (f < 1.0 || f > 3000.0)
141
+ rb_raise(rb_eArgError, "focal length must be between 1 and 3000");
142
+ double width = 0.0;
143
+ SUCameraGetImageWidth(CAMERA(self), &width);
144
+ SUCameraSetPerspectiveFrustumFOV(CAMERA(self), 2.0 * atan(width / (2.0 * f)) * 180.0 / M_PI);
145
+ return focal_length;
146
+ }
147
+
148
+ void Init_camera(void)
149
+ {
150
+ rb_define_alloc_func(cCamera, camera_alloc);
151
+ rb_define_method(cCamera, "initialize", camera_initialize, -1);
152
+ rb_define_method(cCamera, "set", camera_set, 3);
153
+ rb_define_method(cCamera, "eye", camera_eye, 0);
154
+ rb_define_method(cCamera, "target", camera_target, 0);
155
+ rb_define_method(cCamera, "up", camera_up, 0);
156
+ rb_define_method(cCamera, "direction", camera_direction, 0);
157
+ rb_define_method(cCamera, "xaxis", camera_xaxis, 0);
158
+ rb_define_method(cCamera, "yaxis", camera_yaxis, 0);
159
+ rb_define_method(cCamera, "zaxis", camera_zaxis, 0);
160
+ rb_define_method(cCamera, "description", camera_description, 0);
161
+ rb_define_method(cCamera, "description=", camera_set_description, 1);
162
+ rb_define_method(cCamera, "fov", camera_fov, 0);
163
+ rb_define_method(cCamera, "fov=", camera_set_fov, 1);
164
+ rb_define_method(cCamera, "aspect_ratio", camera_aspect_ratio, 0);
165
+ rb_define_method(cCamera, "aspect_ratio=", camera_set_aspect_ratio, 1);
166
+ rb_define_method(cCamera, "height", camera_height, 0);
167
+ rb_define_method(cCamera, "height=", camera_set_height, 1);
168
+ rb_define_method(cCamera, "image_width", camera_image_width, 0);
169
+ rb_define_method(cCamera, "image_width=", camera_set_image_width, 1);
170
+ rb_define_method(cCamera, "perspective?", camera_perspective_p, 0);
171
+ rb_define_method(cCamera, "perspective=", camera_set_perspective, 1);
172
+ rb_define_method(cCamera, "fov_is_height?", camera_fov_is_height_p, 0);
173
+ rb_define_method(cCamera, "is_2d?", camera_is_2d_p, 0);
174
+ rb_define_method(cCamera, "scale_2d", camera_scale_2d, 0);
175
+ rb_define_method(cCamera, "center_2d", camera_center_2d, 0);
176
+ rb_define_method(cCamera, "focal_length", camera_focal_length, 0);
177
+ rb_define_method(cCamera, "focal_length=", camera_set_focal_length, 1);
178
+ }
@@ -0,0 +1,85 @@
1
+ #include <scriptup.h>
2
+
3
+ #define CLASSIFICATIONS(self) SU_REF(SUClassificationsRef, self)
4
+
5
+ DEFINE_STRING_GETTER(classificationschema_name, SUSchemaRef, SUSchemaGetSchemaName)
6
+ DEFINE_REF_LIST(classifications_list, SUClassificationsRef, SUClassificationsGetNumSchemas, SUClassificationsGetSchemas, SUSchemaRef, cClassificationSchema)
7
+
8
+ static VALUE classificationschema_cmp(VALUE self, VALUE other)
9
+ {
10
+ if (!rb_obj_is_kind_of(other, cClassificationSchema))
11
+ return Qnil;
12
+ return INT2FIX(rb_str_cmp(classificationschema_name(self), classificationschema_name(other)));
13
+ }
14
+
15
+ static VALUE classificationschema_eq(VALUE self, VALUE other)
16
+ {
17
+ return BOOL2RB(rb_obj_is_kind_of(other, cClassificationSchema) && DATA_PTR(self) == DATA_PTR(other));
18
+ }
19
+
20
+ static VALUE classifications_to_a(VALUE self) { return classifications_list(CLASSIFICATIONS(self)); }
21
+ static VALUE classifications_each(VALUE self) { su_yield_each(self, classifications_to_a(self)); return Qnil; }
22
+ static VALUE classifications_length(VALUE self) { return LONG2NUM(RARRAY_LEN(classifications_to_a(self))); }
23
+
24
+ static VALUE classifications_keys(VALUE self)
25
+ {
26
+ VALUE schemas = classifications_to_a(self);
27
+ VALUE names = rb_ary_new_capa(RARRAY_LEN(schemas));
28
+ for (long i = 0; i < RARRAY_LEN(schemas); i++)
29
+ rb_ary_push(names, classificationschema_name(RARRAY_AREF(schemas, i)));
30
+ return names;
31
+ }
32
+
33
+ static VALUE classifications_aref(VALUE self, VALUE key)
34
+ {
35
+ if (!RB_TYPE_P(key, T_STRING))
36
+ return rb_ary_entry(classifications_to_a(self), NUM2LONG(key));
37
+ SUSchemaRef schema = SU_INVALID;
38
+ SUClassificationsGetSchema(CLASSIFICATIONS(self), StringValueCStr(key), &schema);
39
+ return su_wrap_or_nil(cClassificationSchema, schema.ptr);
40
+ }
41
+
42
+ static VALUE classifications_load_schema(VALUE self, VALUE file)
43
+ {
44
+ return BOOL2RB(SUClassificationsLoadSchema(CLASSIFICATIONS(self), StringValueCStr(file)) == SU_ERROR_NONE);
45
+ }
46
+
47
+ // Model#classifications
48
+ static VALUE model_classifications(VALUE model)
49
+ {
50
+ SUClassificationsRef classifications = SU_INVALID;
51
+ SUModelGetClassifications(SU_REF(SUModelRef, model), &classifications);
52
+ return su_wrap_or_nil(cClassifications, classifications.ptr);
53
+ }
54
+
55
+ // ComponentDefinition#add_classification(schema_name, type_name)
56
+ static VALUE componentdefinition_add_classification(VALUE self, VALUE schema_name, VALUE type_name)
57
+ {
58
+ SUModelRef model = SU_INVALID;
59
+ SUEntityGetModel(SU_REF(SUEntityRef, self), &model);
60
+ SUClassificationsRef classifications = SU_INVALID;
61
+ SUModelGetClassifications(model, &classifications);
62
+ SUSchemaRef schema = SU_INVALID;
63
+ SUSchemaTypeRef type = SU_INVALID;
64
+ if (SUClassificationsGetSchema(classifications, StringValueCStr(schema_name), &schema) != SU_ERROR_NONE ||
65
+ SUSchemaGetSchemaType(schema, StringValueCStr(type_name), &type) != SU_ERROR_NONE)
66
+ return Qfalse;
67
+ return BOOL2RB(SUComponentDefinitionApplySchemaType(SU_REF(SUComponentDefinitionRef, self), schema, type) == SU_ERROR_NONE);
68
+ }
69
+
70
+ void Init_classifications(void)
71
+ {
72
+ rb_include_module(cClassificationSchema, rb_mComparable);
73
+ rb_define_method(cClassificationSchema, "name", classificationschema_name, 0);
74
+ rb_define_method(cClassificationSchema, "<=>", classificationschema_cmp, 1);
75
+ rb_define_method(cClassificationSchema, "==", classificationschema_eq, 1);
76
+ rb_include_module(cClassifications, rb_mEnumerable);
77
+ rb_define_method(cClassifications, "each", classifications_each, 0);
78
+ rb_define_method(cClassifications, "[]", classifications_aref, 1);
79
+ rb_define_method(cClassifications, "keys", classifications_keys, 0);
80
+ rb_define_method(cClassifications, "length", classifications_length, 0);
81
+ rb_define_method(cClassifications, "size", classifications_length, 0);
82
+ rb_define_method(cClassifications, "load_schema", classifications_load_schema, 1);
83
+ rb_define_method(cModel, "classifications", model_classifications, 0);
84
+ rb_define_method(cComponentDefinition, "add_classification", componentdefinition_add_classification, 2);
85
+ }