scriptup 2026.0.0 → 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 (489) 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 -212
  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 -275
  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/Headers/application/application.h +0 -36
  241. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/model.h +0 -59
  242. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/overlay.h +0 -248
  243. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/ruby_api.h +0 -118
  244. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/color.h +0 -107
  245. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/common.h +0 -178
  246. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/defs.h +0 -19
  247. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/extension_license.h +0 -62
  248. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/bounding_box.h +0 -34
  249. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/plane3d.h +0 -153
  250. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point2d.h +0 -96
  251. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point3d.h +0 -98
  252. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/ray3d.h +0 -64
  253. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation.h +0 -321
  254. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation2d.h +0 -163
  255. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector2d.h +0 -235
  256. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector3d.h +0 -285
  257. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry.h +0 -152
  258. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelexporterplugin.h +0 -165
  259. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelimporterplugin.h +0 -183
  260. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/pluginprogresscallback.h +0 -84
  261. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/initialize.h +0 -43
  262. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/length_formatter.h +0 -424
  263. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arccurve.h +0 -244
  264. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arrow_type.h +0 -17
  265. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/attribute_dictionary.h +0 -161
  266. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/axes.h +0 -242
  267. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/camera.h +0 -398
  268. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_attribute.h +0 -89
  269. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_info.h +0 -125
  270. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classifications.h +0 -86
  271. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition.h +0 -588
  272. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_instance.h +0 -344
  273. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/curve.h +0 -143
  274. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/defs.h +0 -142
  275. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension.h +0 -222
  276. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_linear.h +0 -421
  277. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_radial.h +0 -194
  278. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_style.h +0 -253
  279. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/drawing_element.h +0 -198
  280. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_attribute.h +0 -92
  281. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_info.h +0 -70
  282. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge.h +0 -271
  283. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge_use.h +0 -214
  284. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entities.h +0 -834
  285. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity.h +0 -186
  286. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list.h +0 -80
  287. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list_iterator.h +0 -90
  288. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/face.h +0 -686
  289. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/font.h +0 -138
  290. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry.h +0 -20
  291. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry_input.h +0 -685
  292. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/group.h +0 -244
  293. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_line.h +0 -155
  294. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_point.h +0 -153
  295. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image.h +0 -288
  296. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image_rep.h +0 -275
  297. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/instancepath.h +0 -266
  298. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer.h +0 -265
  299. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer_folder.h +0 -301
  300. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_style.h +0 -211
  301. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_styles.h +0 -81
  302. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/location.h +0 -65
  303. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/loop.h +0 -182
  304. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/material.h +0 -390
  305. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/mesh_helper.h +0 -187
  306. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model.h +0 -1663
  307. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_version.h +0 -49
  308. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/opening.h +0 -72
  309. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_manager.h +0 -79
  310. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_provider.h +0 -166
  311. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/polyline3d.h +0 -140
  312. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/rendering_options.h +0 -179
  313. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/scene.h +0 -836
  314. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema.h +0 -56
  315. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema_type.h +0 -26
  316. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/section_plane.h +0 -212
  317. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/selection.h +0 -156
  318. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/shadow_info.h +0 -147
  319. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/skp.h +0 -45
  320. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/style.h +0 -303
  321. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/styles.h +0 -190
  322. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/text.h +0 -384
  323. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture.h +0 -358
  324. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture_writer.h +0 -280
  325. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/typed_value.h +0 -390
  326. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/uv_helper.h +0 -79
  327. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/vertex.h +0 -154
  328. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup.h +0 -122
  329. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup_info.h +0 -65
  330. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/slapi.h +0 -16
  331. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/transformation.h +0 -16
  332. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/unicodestring.h +0 -239
  333. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/utils/math_helpers.h +0 -124
  334. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonGeometry.dylib +0 -0
  335. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonGeoutils.dylib +0 -0
  336. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonImage.dylib +0 -4
  337. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonPreferences.dylib +0 -0
  338. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonUnits.dylib +0 -0
  339. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonUtils.dylib +0 -0
  340. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Libraries/libCommonZip.dylib +0 -0
  341. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Resources/Info.plist +0 -50
  342. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/SketchUpAPI +0 -0
  343. data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/_CodeSignature/CodeResources +0 -835
  344. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.dll +0 -0
  345. data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.lib +0 -0
  346. data/sketchup-sdk-win/binaries/layout/x64/LayOutControllers.dll +0 -0
  347. data/sketchup-sdk-win/binaries/layout/x64/LayOutModel.dll +0 -0
  348. data/sketchup-sdk-win/binaries/layout/x64/LayOutRTF.dll +0 -0
  349. data/sketchup-sdk-win/binaries/layout/x64/LayOutUtils.dll +0 -0
  350. data/sketchup-sdk-win/binaries/layout/x64/SketchUpCommonPreferences.dll +0 -0
  351. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.dll +0 -0
  352. data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.lib +0 -0
  353. data/sketchup-sdk-win/binaries/layout/x64/pdflib.dll +0 -0
  354. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.dll +0 -0
  355. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.lib +0 -0
  356. data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpCommonPreferences.dll +0 -0
  357. data/sketchup-sdk-win/binaries/sketchup/x64/sketchup.lib +0 -0
  358. data/sketchup-sdk-win/headers/LayOutAPI/application/application.h +0 -117
  359. data/sketchup-sdk-win/headers/LayOutAPI/common.h +0 -22
  360. data/sketchup-sdk-win/headers/LayOutAPI/geometry/geometry.h +0 -78
  361. data/sketchup-sdk-win/headers/LayOutAPI/initialize.h +0 -36
  362. data/sketchup-sdk-win/headers/LayOutAPI/layout.h +0 -49
  363. data/sketchup-sdk-win/headers/LayOutAPI/model/angulardimension.h +0 -468
  364. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinition.h +0 -569
  365. data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinitionlist.h +0 -79
  366. data/sketchup-sdk-win/headers/LayOutAPI/model/connectionpoint.h +0 -107
  367. data/sketchup-sdk-win/headers/LayOutAPI/model/defs.h +0 -42
  368. data/sketchup-sdk-win/headers/LayOutAPI/model/dictionary.h +0 -120
  369. data/sketchup-sdk-win/headers/LayOutAPI/model/document.h +0 -864
  370. data/sketchup-sdk-win/headers/LayOutAPI/model/documentexportoptions.h +0 -59
  371. data/sketchup-sdk-win/headers/LayOutAPI/model/ellipse.h +0 -78
  372. data/sketchup-sdk-win/headers/LayOutAPI/model/entity.h +0 -330
  373. data/sketchup-sdk-win/headers/LayOutAPI/model/entityiterator.h +0 -49
  374. data/sketchup-sdk-win/headers/LayOutAPI/model/entitylist.h +0 -114
  375. data/sketchup-sdk-win/headers/LayOutAPI/model/formattedtext.h +0 -397
  376. data/sketchup-sdk-win/headers/LayOutAPI/model/grid.h +0 -251
  377. data/sketchup-sdk-win/headers/LayOutAPI/model/group.h +0 -243
  378. data/sketchup-sdk-win/headers/LayOutAPI/model/image.h +0 -146
  379. data/sketchup-sdk-win/headers/LayOutAPI/model/imagerep.h +0 -109
  380. data/sketchup-sdk-win/headers/LayOutAPI/model/label.h +0 -332
  381. data/sketchup-sdk-win/headers/LayOutAPI/model/layer.h +0 -207
  382. data/sketchup-sdk-win/headers/LayOutAPI/model/layerinstance.h +0 -117
  383. data/sketchup-sdk-win/headers/LayOutAPI/model/layerlist.h +0 -69
  384. data/sketchup-sdk-win/headers/LayOutAPI/model/lineardimension.h +0 -456
  385. data/sketchup-sdk-win/headers/LayOutAPI/model/page.h +0 -261
  386. data/sketchup-sdk-win/headers/LayOutAPI/model/pageinfo.h +0 -372
  387. data/sketchup-sdk-win/headers/LayOutAPI/model/pagelist.h +0 -81
  388. data/sketchup-sdk-win/headers/LayOutAPI/model/path.h +0 -464
  389. data/sketchup-sdk-win/headers/LayOutAPI/model/rectangle.h +0 -240
  390. data/sketchup-sdk-win/headers/LayOutAPI/model/referenceentity.h +0 -120
  391. data/sketchup-sdk-win/headers/LayOutAPI/model/sketchupmodel.h +0 -624
  392. data/sketchup-sdk-win/headers/LayOutAPI/model/skpfilereference.h +0 -94
  393. data/sketchup-sdk-win/headers/LayOutAPI/model/style.h +0 -1080
  394. data/sketchup-sdk-win/headers/LayOutAPI/model/table.h +0 -470
  395. data/sketchup-sdk-win/headers/LayOutAPI/model/typed_value.h +0 -156
  396. data/sketchup-sdk-win/headers/SketchUpAPI/application/application.h +0 -36
  397. data/sketchup-sdk-win/headers/SketchUpAPI/application/model.h +0 -59
  398. data/sketchup-sdk-win/headers/SketchUpAPI/application/overlay.h +0 -248
  399. data/sketchup-sdk-win/headers/SketchUpAPI/application/ruby_api.h +0 -118
  400. data/sketchup-sdk-win/headers/SketchUpAPI/color.h +0 -107
  401. data/sketchup-sdk-win/headers/SketchUpAPI/common.h +0 -178
  402. data/sketchup-sdk-win/headers/SketchUpAPI/defs.h +0 -19
  403. data/sketchup-sdk-win/headers/SketchUpAPI/extension_license.h +0 -62
  404. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/bounding_box.h +0 -34
  405. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/plane3d.h +0 -153
  406. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point2d.h +0 -96
  407. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point3d.h +0 -98
  408. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/ray3d.h +0 -64
  409. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation.h +0 -321
  410. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation2d.h +0 -163
  411. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector2d.h +0 -235
  412. data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector3d.h +0 -285
  413. data/sketchup-sdk-win/headers/SketchUpAPI/geometry.h +0 -152
  414. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelexporterplugin.h +0 -165
  415. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelimporterplugin.h +0 -183
  416. data/sketchup-sdk-win/headers/SketchUpAPI/import_export/pluginprogresscallback.h +0 -84
  417. data/sketchup-sdk-win/headers/SketchUpAPI/initialize.h +0 -43
  418. data/sketchup-sdk-win/headers/SketchUpAPI/length_formatter.h +0 -424
  419. data/sketchup-sdk-win/headers/SketchUpAPI/model/arccurve.h +0 -244
  420. data/sketchup-sdk-win/headers/SketchUpAPI/model/arrow_type.h +0 -17
  421. data/sketchup-sdk-win/headers/SketchUpAPI/model/attribute_dictionary.h +0 -161
  422. data/sketchup-sdk-win/headers/SketchUpAPI/model/axes.h +0 -242
  423. data/sketchup-sdk-win/headers/SketchUpAPI/model/camera.h +0 -398
  424. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_attribute.h +0 -89
  425. data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_info.h +0 -125
  426. data/sketchup-sdk-win/headers/SketchUpAPI/model/classifications.h +0 -86
  427. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition.h +0 -588
  428. data/sketchup-sdk-win/headers/SketchUpAPI/model/component_instance.h +0 -344
  429. data/sketchup-sdk-win/headers/SketchUpAPI/model/curve.h +0 -143
  430. data/sketchup-sdk-win/headers/SketchUpAPI/model/defs.h +0 -142
  431. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension.h +0 -222
  432. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_linear.h +0 -421
  433. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_radial.h +0 -194
  434. data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_style.h +0 -253
  435. data/sketchup-sdk-win/headers/SketchUpAPI/model/drawing_element.h +0 -198
  436. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_attribute.h +0 -92
  437. data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_info.h +0 -70
  438. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge.h +0 -271
  439. data/sketchup-sdk-win/headers/SketchUpAPI/model/edge_use.h +0 -214
  440. data/sketchup-sdk-win/headers/SketchUpAPI/model/entities.h +0 -834
  441. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity.h +0 -186
  442. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list.h +0 -80
  443. data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list_iterator.h +0 -90
  444. data/sketchup-sdk-win/headers/SketchUpAPI/model/face.h +0 -686
  445. data/sketchup-sdk-win/headers/SketchUpAPI/model/font.h +0 -138
  446. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry.h +0 -20
  447. data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry_input.h +0 -685
  448. data/sketchup-sdk-win/headers/SketchUpAPI/model/group.h +0 -244
  449. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_line.h +0 -155
  450. data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_point.h +0 -153
  451. data/sketchup-sdk-win/headers/SketchUpAPI/model/image.h +0 -288
  452. data/sketchup-sdk-win/headers/SketchUpAPI/model/image_rep.h +0 -275
  453. data/sketchup-sdk-win/headers/SketchUpAPI/model/instancepath.h +0 -266
  454. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer.h +0 -265
  455. data/sketchup-sdk-win/headers/SketchUpAPI/model/layer_folder.h +0 -301
  456. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_style.h +0 -211
  457. data/sketchup-sdk-win/headers/SketchUpAPI/model/line_styles.h +0 -81
  458. data/sketchup-sdk-win/headers/SketchUpAPI/model/location.h +0 -65
  459. data/sketchup-sdk-win/headers/SketchUpAPI/model/loop.h +0 -182
  460. data/sketchup-sdk-win/headers/SketchUpAPI/model/material.h +0 -390
  461. data/sketchup-sdk-win/headers/SketchUpAPI/model/mesh_helper.h +0 -187
  462. data/sketchup-sdk-win/headers/SketchUpAPI/model/model.h +0 -1663
  463. data/sketchup-sdk-win/headers/SketchUpAPI/model/model_version.h +0 -49
  464. data/sketchup-sdk-win/headers/SketchUpAPI/model/opening.h +0 -72
  465. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_manager.h +0 -79
  466. data/sketchup-sdk-win/headers/SketchUpAPI/model/options_provider.h +0 -166
  467. data/sketchup-sdk-win/headers/SketchUpAPI/model/polyline3d.h +0 -140
  468. data/sketchup-sdk-win/headers/SketchUpAPI/model/rendering_options.h +0 -179
  469. data/sketchup-sdk-win/headers/SketchUpAPI/model/scene.h +0 -836
  470. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema.h +0 -56
  471. data/sketchup-sdk-win/headers/SketchUpAPI/model/schema_type.h +0 -26
  472. data/sketchup-sdk-win/headers/SketchUpAPI/model/section_plane.h +0 -212
  473. data/sketchup-sdk-win/headers/SketchUpAPI/model/selection.h +0 -156
  474. data/sketchup-sdk-win/headers/SketchUpAPI/model/shadow_info.h +0 -147
  475. data/sketchup-sdk-win/headers/SketchUpAPI/model/skp.h +0 -45
  476. data/sketchup-sdk-win/headers/SketchUpAPI/model/style.h +0 -303
  477. data/sketchup-sdk-win/headers/SketchUpAPI/model/styles.h +0 -190
  478. data/sketchup-sdk-win/headers/SketchUpAPI/model/text.h +0 -384
  479. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture.h +0 -358
  480. data/sketchup-sdk-win/headers/SketchUpAPI/model/texture_writer.h +0 -280
  481. data/sketchup-sdk-win/headers/SketchUpAPI/model/typed_value.h +0 -390
  482. data/sketchup-sdk-win/headers/SketchUpAPI/model/uv_helper.h +0 -79
  483. data/sketchup-sdk-win/headers/SketchUpAPI/model/vertex.h +0 -154
  484. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup.h +0 -122
  485. data/sketchup-sdk-win/headers/SketchUpAPI/sketchup_info.h +0 -65
  486. data/sketchup-sdk-win/headers/SketchUpAPI/slapi.h +0 -16
  487. data/sketchup-sdk-win/headers/SketchUpAPI/transformation.h +0 -16
  488. data/sketchup-sdk-win/headers/SketchUpAPI/unicodestring.h +0 -239
  489. data/sketchup-sdk-win/headers/SketchUpAPI/utils/math_helpers.h +0 -124
data/ext/vector2d.c ADDED
@@ -0,0 +1,238 @@
1
+ #include <scriptup.h>
2
+
3
+ #define VEC(obj) ((struct SUVector2D*)DATA_PTR(obj))
4
+
5
+ static VALUE vector2d_alloc(VALUE klass)
6
+ {
7
+ struct SUVector2D* v;
8
+ VALUE obj = Data_Make_Struct(klass, struct SUVector2D, 0, RUBY_DEFAULT_FREE, v);
9
+ *v = (struct SUVector2D){0.0, 0.0};
10
+ return obj;
11
+ }
12
+
13
+ VALUE su_vector2d_new(struct SUVector2D value)
14
+ {
15
+ VALUE obj = vector2d_alloc(cVector2d);
16
+ *VEC(obj) = value;
17
+ return obj;
18
+ }
19
+
20
+ struct SUVector2D su_to_vector2d(VALUE obj)
21
+ {
22
+ if (rb_obj_is_kind_of(obj, cVector2d))
23
+ return *VEC(obj);
24
+ double xy[2];
25
+ su_array_to_xy(obj, xy);
26
+ return (struct SUVector2D){xy[0], xy[1]};
27
+ }
28
+
29
+ static VALUE vector2d_initialize(int argc, VALUE* argv, VALUE self)
30
+ {
31
+ rb_check_arity(argc, 0, 2);
32
+ if (argc == 1)
33
+ *VEC(self) = su_to_vector2d(argv[0]);
34
+ else if (argc == 2)
35
+ *VEC(self) = (struct SUVector2D){NUM2DBL(argv[0]), NUM2DBL(argv[1])};
36
+ return self;
37
+ }
38
+
39
+ static VALUE vector2d_initialize_copy(VALUE self, VALUE other)
40
+ {
41
+ *VEC(self) = *VEC(other);
42
+ return self;
43
+ }
44
+
45
+ static VALUE vector2d_set_bang(int argc, VALUE* argv, VALUE self)
46
+ {
47
+ return vector2d_initialize(argc, argv, self);
48
+ }
49
+
50
+ #define DEFINE_COMPONENT(axis) \
51
+ static VALUE vector2d_##axis(VALUE self) { return DBL2NUM(VEC(self)->axis); } \
52
+ static VALUE vector2d_set_##axis(VALUE self, VALUE value) \
53
+ { \
54
+ VEC(self)->axis = NUM2DBL(value); \
55
+ return value; \
56
+ }
57
+ DEFINE_COMPONENT(x)
58
+ DEFINE_COMPONENT(y)
59
+
60
+ static double* vector2d_component(VALUE self, VALUE index)
61
+ {
62
+ long i = NUM2LONG(index);
63
+ if (i < 0 || i > 1)
64
+ rb_raise(rb_eIndexError, "index %ld out of range [0, 1]", i);
65
+ return i == 0 ? &VEC(self)->x : &VEC(self)->y;
66
+ }
67
+
68
+ static VALUE vector2d_aref(VALUE self, VALUE index)
69
+ {
70
+ return DBL2NUM(*vector2d_component(self, index));
71
+ }
72
+
73
+ static VALUE vector2d_aset(VALUE self, VALUE index, VALUE value)
74
+ {
75
+ *vector2d_component(self, index) = NUM2DBL(value);
76
+ return value;
77
+ }
78
+
79
+ static VALUE vector2d_to_a(VALUE self)
80
+ {
81
+ return rb_ary_new_from_args(2, DBL2NUM(VEC(self)->x), DBL2NUM(VEC(self)->y));
82
+ }
83
+
84
+ static VALUE vector2d_to_s(VALUE self)
85
+ {
86
+ return rb_sprintf("(%"PRIsVALUE", %"PRIsVALUE")", su_format_number(VEC(self)->x), su_format_number(VEC(self)->y));
87
+ }
88
+
89
+ static VALUE vector2d_inspect(VALUE self)
90
+ {
91
+ return rb_sprintf("Vector2d%"PRIsVALUE, vector2d_to_s(self));
92
+ }
93
+
94
+ static VALUE vector2d_plus(VALUE self, VALUE other)
95
+ {
96
+ struct SUVector2D b = su_to_vector2d(other);
97
+ return su_vector2d_new((struct SUVector2D){VEC(self)->x + b.x, VEC(self)->y + b.y});
98
+ }
99
+
100
+ static VALUE vector2d_minus(VALUE self, VALUE other)
101
+ {
102
+ struct SUVector2D b = su_to_vector2d(other);
103
+ return su_vector2d_new((struct SUVector2D){VEC(self)->x - b.x, VEC(self)->y - b.y});
104
+ }
105
+
106
+ #define DEFINE_SCALAR_OP(fn, SUFn) \
107
+ static VALUE fn(VALUE self, VALUE other) \
108
+ { \
109
+ struct SUVector2D b = su_to_vector2d(other); \
110
+ double result = 0.0; \
111
+ SUFn(VEC(self), &b, &result); \
112
+ return DBL2NUM(result); \
113
+ }
114
+ DEFINE_SCALAR_OP(vector2d_dot, SUVector2DDot)
115
+ DEFINE_SCALAR_OP(vector2d_cross, SUVector2DCross)
116
+ DEFINE_SCALAR_OP(vector2d_angle_between, SUVector2DAngleBetween)
117
+
118
+ #define DEFINE_PREDICATE(fn, SUFn) \
119
+ static VALUE fn(VALUE self, VALUE other) \
120
+ { \
121
+ struct SUVector2D b = su_to_vector2d(other); \
122
+ bool result = false; \
123
+ SUFn(VEC(self), &b, &result); \
124
+ return BOOL2RB(result); \
125
+ }
126
+ DEFINE_PREDICATE(vector2d_parallel_p, SUVector2DIsParallelTo)
127
+ DEFINE_PREDICATE(vector2d_perpendicular_p, SUVector2DIsPerpendicularTo)
128
+ DEFINE_PREDICATE(vector2d_same_direction_p, SUVector2DIsSameDirectionAs)
129
+
130
+ static VALUE vector2d_eq(VALUE self, VALUE other)
131
+ {
132
+ if (!rb_obj_is_kind_of(other, cVector2d) && !RB_TYPE_P(other, T_ARRAY))
133
+ return Qfalse;
134
+ struct SUVector2D b = su_to_vector2d(other);
135
+ bool equal = false;
136
+ SUVector2DIsEqual(VEC(self), &b, &equal);
137
+ return BOOL2RB(equal);
138
+ }
139
+
140
+ static VALUE vector2d_unit_vector_p(VALUE self)
141
+ {
142
+ bool unit = false;
143
+ SUVector2DIsUnitVector(VEC(self), &unit);
144
+ return BOOL2RB(unit);
145
+ }
146
+
147
+ static VALUE vector2d_valid_p(VALUE self)
148
+ {
149
+ bool valid = false;
150
+ SUVector2DIsValid(VEC(self), &valid);
151
+ return BOOL2RB(valid);
152
+ }
153
+
154
+ static VALUE vector2d_length(VALUE self)
155
+ {
156
+ double length = 0.0;
157
+ SUVector2DGetLength(VEC(self), &length);
158
+ return su_length_new(length);
159
+ }
160
+
161
+ static VALUE vector2d_set_length(VALUE self, VALUE length)
162
+ {
163
+ if (SUVector2DSetLength(VEC(self), NUM2DBL(length)) != SU_ERROR_NONE)
164
+ rb_raise(rb_eArgError, "Cannot set the length of a zero length vector");
165
+ return length;
166
+ }
167
+
168
+ static VALUE vector2d_normalize_bang(VALUE self)
169
+ {
170
+ SUVector2DNormalize(VEC(self));
171
+ return self;
172
+ }
173
+
174
+ static VALUE vector2d_normalize(VALUE self)
175
+ {
176
+ return vector2d_normalize_bang(su_vector2d_new(*VEC(self)));
177
+ }
178
+
179
+ static VALUE vector2d_reverse_bang(VALUE self)
180
+ {
181
+ SUVector2DReverse(VEC(self));
182
+ return self;
183
+ }
184
+
185
+ static VALUE vector2d_reverse(VALUE self)
186
+ {
187
+ return vector2d_reverse_bang(su_vector2d_new(*VEC(self)));
188
+ }
189
+
190
+ static VALUE vector2d_transform_bang(VALUE self, VALUE transformation)
191
+ {
192
+ struct SUTransformation2D t = su_to_transformation2d(transformation);
193
+ SUVector2DTransform(&t, VEC(self));
194
+ return self;
195
+ }
196
+
197
+ static VALUE vector2d_transform(VALUE self, VALUE transformation)
198
+ {
199
+ return vector2d_transform_bang(su_vector2d_new(*VEC(self)), transformation);
200
+ }
201
+
202
+ void Init_vector2d(void)
203
+ {
204
+ rb_define_alloc_func(cVector2d, vector2d_alloc);
205
+ rb_define_method(cVector2d, "transform", vector2d_transform, 1);
206
+ rb_define_method(cVector2d, "transform!", vector2d_transform_bang, 1);
207
+ rb_define_method(cVector2d, "initialize", vector2d_initialize, -1);
208
+ rb_define_method(cVector2d, "initialize_copy", vector2d_initialize_copy, 1);
209
+ rb_define_method(cVector2d, "set!", vector2d_set_bang, -1);
210
+ rb_define_method(cVector2d, "x", vector2d_x, 0);
211
+ rb_define_method(cVector2d, "x=", vector2d_set_x, 1);
212
+ rb_define_method(cVector2d, "y", vector2d_y, 0);
213
+ rb_define_method(cVector2d, "y=", vector2d_set_y, 1);
214
+ rb_define_method(cVector2d, "[]", vector2d_aref, 1);
215
+ rb_define_method(cVector2d, "[]=", vector2d_aset, 2);
216
+ rb_define_method(cVector2d, "to_a", vector2d_to_a, 0);
217
+ rb_define_method(cVector2d, "to_s", vector2d_to_s, 0);
218
+ rb_define_method(cVector2d, "inspect", vector2d_inspect, 0);
219
+ rb_define_method(cVector2d, "+", vector2d_plus, 1);
220
+ rb_define_method(cVector2d, "-", vector2d_minus, 1);
221
+ rb_define_method(cVector2d, "%", vector2d_dot, 1);
222
+ rb_define_method(cVector2d, "dot", vector2d_dot, 1);
223
+ rb_define_method(cVector2d, "*", vector2d_cross, 1);
224
+ rb_define_method(cVector2d, "cross", vector2d_cross, 1);
225
+ rb_define_method(cVector2d, "angle_between", vector2d_angle_between, 1);
226
+ rb_define_method(cVector2d, "==", vector2d_eq, 1);
227
+ rb_define_method(cVector2d, "parallel?", vector2d_parallel_p, 1);
228
+ rb_define_method(cVector2d, "perpendicular?", vector2d_perpendicular_p, 1);
229
+ rb_define_method(cVector2d, "same_direction?", vector2d_same_direction_p, 1);
230
+ rb_define_method(cVector2d, "unit_vector?", vector2d_unit_vector_p, 0);
231
+ rb_define_method(cVector2d, "valid?", vector2d_valid_p, 0);
232
+ rb_define_method(cVector2d, "length", vector2d_length, 0);
233
+ rb_define_method(cVector2d, "length=", vector2d_set_length, 1);
234
+ rb_define_method(cVector2d, "normalize", vector2d_normalize, 0);
235
+ rb_define_method(cVector2d, "normalize!", vector2d_normalize_bang, 0);
236
+ rb_define_method(cVector2d, "reverse", vector2d_reverse, 0);
237
+ rb_define_method(cVector2d, "reverse!", vector2d_reverse_bang, 0);
238
+ }
data/ext/vector3d.c ADDED
@@ -0,0 +1,294 @@
1
+ #include <scriptup.h>
2
+
3
+ #define VEC(obj) ((struct SUVector3D*)DATA_PTR(obj))
4
+
5
+ static VALUE vector3d_alloc(VALUE klass)
6
+ {
7
+ struct SUVector3D* v;
8
+ VALUE obj = Data_Make_Struct(klass, struct SUVector3D, 0, RUBY_DEFAULT_FREE, v);
9
+ *v = (struct SUVector3D){0.0, 0.0, 0.0};
10
+ return obj;
11
+ }
12
+
13
+ VALUE su_vector3d_new(struct SUVector3D value)
14
+ {
15
+ VALUE obj = vector3d_alloc(cVector3d);
16
+ *VEC(obj) = value;
17
+ return obj;
18
+ }
19
+
20
+ // Accepts a Vector3d or a 2/3 element numeric array.
21
+ struct SUVector3D su_to_vector3d(VALUE obj)
22
+ {
23
+ if (rb_obj_is_kind_of(obj, cVector3d))
24
+ return *VEC(obj);
25
+ double xyz[3];
26
+ su_array_to_xyz(obj, xyz);
27
+ return (struct SUVector3D){xyz[0], xyz[1], xyz[2]};
28
+ }
29
+
30
+ static VALUE vector3d_initialize(int argc, VALUE* argv, VALUE self)
31
+ {
32
+ rb_check_arity(argc, 0, 3);
33
+ if (argc == 1)
34
+ *VEC(self) = su_to_vector3d(argv[0]);
35
+ else if (argc == 2)
36
+ rb_raise(rb_eArgError, "wrong number of arguments (given 2, expected 0, 1 or 3)");
37
+ else if (argc == 3)
38
+ *VEC(self) = (struct SUVector3D){NUM2DBL(argv[0]), NUM2DBL(argv[1]), NUM2DBL(argv[2])};
39
+ return self;
40
+ }
41
+
42
+ static VALUE vector3d_initialize_copy(VALUE self, VALUE other)
43
+ {
44
+ *VEC(self) = *VEC(other);
45
+ return self;
46
+ }
47
+
48
+ static VALUE vector3d_set_bang(int argc, VALUE* argv, VALUE self)
49
+ {
50
+ vector3d_initialize(argc, argv, self);
51
+ return self;
52
+ }
53
+
54
+ static VALUE vector3d_linear_combination(int argc, VALUE* argv, VALUE klass)
55
+ {
56
+ if (argc != 4 && argc != 6)
57
+ rb_raise(rb_eArgError, "wrong number of arguments (given %d, expected 4 or 6)", argc);
58
+ struct SUVector3D vectors[3];
59
+ double weights[3];
60
+ size_t count = (size_t)argc / 2;
61
+ for (size_t i = 0; i < count; i++)
62
+ {
63
+ weights[i] = NUM2DBL(argv[i * 2]);
64
+ vectors[i] = su_to_vector3d(argv[i * 2 + 1]);
65
+ }
66
+ struct SUVector3D result;
67
+ SUVector3DLinearCombination(vectors, weights, count, &result);
68
+ return su_vector3d_new(result);
69
+ }
70
+
71
+ #define DEFINE_COMPONENT(axis) \
72
+ static VALUE vector3d_##axis(VALUE self) { return DBL2NUM(VEC(self)->axis); } \
73
+ static VALUE vector3d_set_##axis(VALUE self, VALUE value) \
74
+ { \
75
+ VEC(self)->axis = NUM2DBL(value); \
76
+ return value; \
77
+ }
78
+ DEFINE_COMPONENT(x)
79
+ DEFINE_COMPONENT(y)
80
+ DEFINE_COMPONENT(z)
81
+
82
+ static double* vector3d_component(VALUE self, VALUE index)
83
+ {
84
+ long i = NUM2LONG(index);
85
+ if (i < 0 || i > 2)
86
+ rb_raise(rb_eIndexError, "index %ld out of range [0, 2]", i);
87
+ double* components[3] = {&VEC(self)->x, &VEC(self)->y, &VEC(self)->z};
88
+ return components[i];
89
+ }
90
+
91
+ static VALUE vector3d_aref(VALUE self, VALUE index)
92
+ {
93
+ return su_length_new(*vector3d_component(self, index));
94
+ }
95
+
96
+ static VALUE vector3d_aset(VALUE self, VALUE index, VALUE value)
97
+ {
98
+ *vector3d_component(self, index) = NUM2DBL(value);
99
+ return value;
100
+ }
101
+
102
+ static VALUE vector3d_to_a(VALUE self)
103
+ {
104
+ struct SUVector3D* v = VEC(self);
105
+ return rb_ary_new_from_args(3, DBL2NUM(v->x), DBL2NUM(v->y), DBL2NUM(v->z));
106
+ }
107
+
108
+ static VALUE vector3d_to_s(VALUE self)
109
+ {
110
+ struct SUVector3D* v = VEC(self);
111
+ return rb_sprintf("(%"PRIsVALUE", %"PRIsVALUE", %"PRIsVALUE")",
112
+ su_format_number(v->x), su_format_number(v->y), su_format_number(v->z));
113
+ }
114
+
115
+ static VALUE vector3d_inspect(VALUE self)
116
+ {
117
+ return rb_sprintf("Vector3d%"PRIsVALUE, vector3d_to_s(self));
118
+ }
119
+
120
+ static VALUE vector3d_plus(VALUE self, VALUE other)
121
+ {
122
+ struct SUVector3D a = *VEC(self);
123
+ struct SUVector3D b = su_to_vector3d(other);
124
+ return su_vector3d_new((struct SUVector3D){a.x + b.x, a.y + b.y, a.z + b.z});
125
+ }
126
+
127
+ static VALUE vector3d_minus(VALUE self, VALUE other)
128
+ {
129
+ struct SUVector3D a = *VEC(self);
130
+ struct SUVector3D b = su_to_vector3d(other);
131
+ return su_vector3d_new((struct SUVector3D){a.x - b.x, a.y - b.y, a.z - b.z});
132
+ }
133
+
134
+ static VALUE vector3d_cross(VALUE self, VALUE other)
135
+ {
136
+ struct SUVector3D b = su_to_vector3d(other);
137
+ struct SUVector3D result;
138
+ SUVector3DCross(VEC(self), &b, &result);
139
+ return su_vector3d_new(result);
140
+ }
141
+
142
+ static VALUE vector3d_dot(VALUE self, VALUE other)
143
+ {
144
+ struct SUVector3D b = su_to_vector3d(other);
145
+ double result = 0.0;
146
+ SUVector3DDot(VEC(self), &b, &result);
147
+ return DBL2NUM(result);
148
+ }
149
+
150
+ static VALUE vector3d_angle_between(VALUE self, VALUE other)
151
+ {
152
+ struct SUVector3D b = su_to_vector3d(other);
153
+ double angle = 0.0;
154
+ SUVector3DAngleBetween(VEC(self), &b, &angle);
155
+ return DBL2NUM(angle);
156
+ }
157
+
158
+ #define DEFINE_VECTOR_PREDICATE(fn, SUFn) \
159
+ static VALUE fn(VALUE self, VALUE other) \
160
+ { \
161
+ struct SUVector3D b = su_to_vector3d(other); \
162
+ bool result = false; \
163
+ SUFn(VEC(self), &b, &result); \
164
+ return BOOL2RB(result); \
165
+ }
166
+ DEFINE_VECTOR_PREDICATE(vector3d_parallel_p, SUVector3DIsParallelTo)
167
+ DEFINE_VECTOR_PREDICATE(vector3d_perpendicular_p, SUVector3DIsPerpendicularTo)
168
+ DEFINE_VECTOR_PREDICATE(vector3d_samedirection_p, SUVector3DIsSameDirectionAs)
169
+ DEFINE_VECTOR_PREDICATE(vector3d_lt, SUVector3DLessThan)
170
+
171
+ static VALUE vector3d_eq(VALUE self, VALUE other)
172
+ {
173
+ if (!rb_obj_is_kind_of(other, cVector3d) && !RB_TYPE_P(other, T_ARRAY))
174
+ return Qfalse;
175
+ struct SUVector3D b = su_to_vector3d(other);
176
+ bool equal = false;
177
+ SUVector3DIsEqual(VEC(self), &b, &equal);
178
+ return BOOL2RB(equal);
179
+ }
180
+
181
+ static VALUE vector3d_unitvector_p(VALUE self)
182
+ {
183
+ bool unit = false;
184
+ SUVector3DIsUnitVector(VEC(self), &unit);
185
+ return BOOL2RB(unit);
186
+ }
187
+
188
+ static VALUE vector3d_valid_p(VALUE self)
189
+ {
190
+ bool valid = false;
191
+ SUVector3DIsValid(VEC(self), &valid);
192
+ return BOOL2RB(valid);
193
+ }
194
+
195
+ static VALUE vector3d_length(VALUE self)
196
+ {
197
+ double length = 0.0;
198
+ SUVector3DGetLength(VEC(self), &length);
199
+ return su_length_new(length);
200
+ }
201
+
202
+ static VALUE vector3d_set_length(VALUE self, VALUE length)
203
+ {
204
+ if (SUVector3DSetLength(VEC(self), NUM2DBL(length)) != SU_ERROR_NONE)
205
+ rb_raise(rb_eArgError, "Cannot set the length of a zero length vector");
206
+ return length;
207
+ }
208
+
209
+ static VALUE vector3d_normalize_bang(VALUE self)
210
+ {
211
+ SUVector3DNormalize(VEC(self));
212
+ return self;
213
+ }
214
+
215
+ static VALUE vector3d_normalize(VALUE self)
216
+ {
217
+ return vector3d_normalize_bang(su_vector3d_new(*VEC(self)));
218
+ }
219
+
220
+ static VALUE vector3d_reverse_bang(VALUE self)
221
+ {
222
+ SUVector3DReverse(VEC(self));
223
+ return self;
224
+ }
225
+
226
+ static VALUE vector3d_reverse(VALUE self)
227
+ {
228
+ return vector3d_reverse_bang(su_vector3d_new(*VEC(self)));
229
+ }
230
+
231
+ static VALUE vector3d_axes(VALUE self)
232
+ {
233
+ struct SUVector3D x_axis;
234
+ struct SUVector3D y_axis;
235
+ SUVector3DGetArbitraryAxes(VEC(self), &x_axis, &y_axis);
236
+ struct SUVector3D z_axis = *VEC(self);
237
+ SUVector3DNormalize(&z_axis);
238
+ return rb_ary_new_from_args(3, su_vector3d_new(x_axis), su_vector3d_new(y_axis), su_vector3d_new(z_axis));
239
+ }
240
+
241
+ static VALUE vector3d_transform_bang(VALUE self, VALUE transformation)
242
+ {
243
+ struct SUTransformation t = su_to_transformation(transformation);
244
+ SUVector3DTransform(&t, VEC(self));
245
+ return self;
246
+ }
247
+
248
+ static VALUE vector3d_transform(VALUE self, VALUE transformation)
249
+ {
250
+ return vector3d_transform_bang(su_vector3d_new(*VEC(self)), transformation);
251
+ }
252
+
253
+ void Init_vector3d(void)
254
+ {
255
+ rb_define_alloc_func(cVector3d, vector3d_alloc);
256
+ rb_define_method(cVector3d, "transform", vector3d_transform, 1);
257
+ rb_define_method(cVector3d, "transform!", vector3d_transform_bang, 1);
258
+ rb_define_singleton_method(cVector3d, "linear_combination", vector3d_linear_combination, -1);
259
+ rb_define_method(cVector3d, "initialize", vector3d_initialize, -1);
260
+ rb_define_method(cVector3d, "initialize_copy", vector3d_initialize_copy, 1);
261
+ rb_define_method(cVector3d, "set!", vector3d_set_bang, -1);
262
+ rb_define_method(cVector3d, "x", vector3d_x, 0);
263
+ rb_define_method(cVector3d, "x=", vector3d_set_x, 1);
264
+ rb_define_method(cVector3d, "y", vector3d_y, 0);
265
+ rb_define_method(cVector3d, "y=", vector3d_set_y, 1);
266
+ rb_define_method(cVector3d, "z", vector3d_z, 0);
267
+ rb_define_method(cVector3d, "z=", vector3d_set_z, 1);
268
+ rb_define_method(cVector3d, "[]", vector3d_aref, 1);
269
+ rb_define_method(cVector3d, "[]=", vector3d_aset, 2);
270
+ rb_define_method(cVector3d, "to_a", vector3d_to_a, 0);
271
+ rb_define_method(cVector3d, "to_s", vector3d_to_s, 0);
272
+ rb_define_method(cVector3d, "inspect", vector3d_inspect, 0);
273
+ rb_define_method(cVector3d, "+", vector3d_plus, 1);
274
+ rb_define_method(cVector3d, "-", vector3d_minus, 1);
275
+ rb_define_method(cVector3d, "*", vector3d_cross, 1);
276
+ rb_define_method(cVector3d, "cross", vector3d_cross, 1);
277
+ rb_define_method(cVector3d, "%", vector3d_dot, 1);
278
+ rb_define_method(cVector3d, "dot", vector3d_dot, 1);
279
+ rb_define_method(cVector3d, "<", vector3d_lt, 1);
280
+ rb_define_method(cVector3d, "==", vector3d_eq, 1);
281
+ rb_define_method(cVector3d, "angle_between", vector3d_angle_between, 1);
282
+ rb_define_method(cVector3d, "parallel?", vector3d_parallel_p, 1);
283
+ rb_define_method(cVector3d, "perpendicular?", vector3d_perpendicular_p, 1);
284
+ rb_define_method(cVector3d, "samedirection?", vector3d_samedirection_p, 1);
285
+ rb_define_method(cVector3d, "unitvector?", vector3d_unitvector_p, 0);
286
+ rb_define_method(cVector3d, "valid?", vector3d_valid_p, 0);
287
+ rb_define_method(cVector3d, "length", vector3d_length, 0);
288
+ rb_define_method(cVector3d, "length=", vector3d_set_length, 1);
289
+ rb_define_method(cVector3d, "normalize", vector3d_normalize, 0);
290
+ rb_define_method(cVector3d, "normalize!", vector3d_normalize_bang, 0);
291
+ rb_define_method(cVector3d, "reverse", vector3d_reverse, 0);
292
+ rb_define_method(cVector3d, "reverse!", vector3d_reverse_bang, 0);
293
+ rb_define_method(cVector3d, "axes", vector3d_axes, 0);
294
+ }
data/ext/vertex.c ADDED
@@ -0,0 +1,67 @@
1
+ #include <scriptup.h>
2
+
3
+ #define VERTEX(self) SU_REF(SUVertexRef, self)
4
+
5
+ DEFINE_REF_LIST(vertex_edge_list, SUVertexRef, SUVertexGetNumEdges, SUVertexGetEdges, SUEdgeRef, cEdge)
6
+ DEFINE_REF_LIST(vertex_face_list, SUVertexRef, SUVertexGetNumFaces, SUVertexGetFaces, SUFaceRef, cFace)
7
+ DEFINE_REF_LIST(vertex_loop_list, SUVertexRef, SUVertexGetNumLoops, SUVertexGetLoops, SULoopRef, cLoop)
8
+
9
+ static VALUE vertex_edges(VALUE self) { return vertex_edge_list(VERTEX(self)); }
10
+ static VALUE vertex_faces(VALUE self) { return vertex_face_list(VERTEX(self)); }
11
+ static VALUE vertex_loops(VALUE self) { return vertex_loop_list(VERTEX(self)); }
12
+
13
+ static VALUE vertex_position(VALUE self)
14
+ {
15
+ struct SUPoint3D p = {0, 0, 0};
16
+ SUVertexGetPosition(VERTEX(self), &p);
17
+ return su_point3d_new(p);
18
+ }
19
+
20
+ static VALUE vertex_common_edge(VALUE self, VALUE other)
21
+ {
22
+ su_unwrap(other, cVertex);
23
+ VALUE edges = vertex_edges(self);
24
+ VALUE other_edges = vertex_edges(other);
25
+ for (long i = 0; i < RARRAY_LEN(edges); i++)
26
+ if (RTEST(rb_ary_includes(other_edges, RARRAY_AREF(edges, i))))
27
+ return RARRAY_AREF(edges, i);
28
+ return Qnil;
29
+ }
30
+
31
+ static VALUE vertex_used_by_p(VALUE self, VALUE element)
32
+ {
33
+ if (rb_obj_is_kind_of(element, cEdge))
34
+ return rb_ary_includes(vertex_edges(self), element);
35
+ if (rb_obj_is_kind_of(element, cFace))
36
+ return rb_ary_includes(vertex_faces(self), element);
37
+ rb_raise(rb_eTypeError, "expected an Edge or a Face");
38
+ }
39
+
40
+ // The arc curve this vertex is inside of (not an end point of), if any.
41
+ static VALUE vertex_curve_interior_p(VALUE self)
42
+ {
43
+ VALUE edges = vertex_edges(self);
44
+ if (RARRAY_LEN(edges) != 2)
45
+ return Qnil;
46
+ SUCurveRef curves[2];
47
+ for (long i = 0; i < 2; i++)
48
+ {
49
+ curves[i].ptr = NULL;
50
+ SUEdgeGetCurve(SU_REF(SUEdgeRef, RARRAY_AREF(edges, i)), &curves[i]);
51
+ }
52
+ if (SUIsInvalid(curves[0]) || curves[0].ptr != curves[1].ptr)
53
+ return Qnil;
54
+ VALUE curve = su_wrap_entity((SUEntityRef){curves[0].ptr});
55
+ return rb_obj_is_kind_of(curve, cArcCurve) ? curve : Qnil;
56
+ }
57
+
58
+ void Init_vertex(void)
59
+ {
60
+ rb_define_method(cVertex, "position", vertex_position, 0);
61
+ rb_define_method(cVertex, "edges", vertex_edges, 0);
62
+ rb_define_method(cVertex, "faces", vertex_faces, 0);
63
+ rb_define_method(cVertex, "loops", vertex_loops, 0);
64
+ rb_define_method(cVertex, "common_edge", vertex_common_edge, 1);
65
+ rb_define_method(cVertex, "used_by?", vertex_used_by_p, 1);
66
+ rb_define_method(cVertex, "curve_interior?", vertex_curve_interior_p, 0);
67
+ }
data/lib/sketchup.rb CHANGED
@@ -5,8 +5,8 @@ when /linux/
5
5
  raise "Unsupported platform for SketchUpAPI"
6
6
  else # assuming windows
7
7
  require 'fiddle'
8
- Fiddle.dlopen("#{__dir__}/../sketchup-sdk-win/binaries/sketchup/x64/SketchUpCommonPreferences.dll")
9
- Fiddle.dlopen("#{__dir__}/../sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.dll")
8
+ Fiddle.dlopen("#{__dir__}/../sketchup-sdk/binaries/sketchup/x64/SketchUpCommonPreferences.dll")
9
+ Fiddle.dlopen("#{__dir__}/../sketchup-sdk/binaries/sketchup/x64/SketchUpAPI.dll")
10
10
  require "#{__dir__}/sketchup.so"
11
11
  end
12
12