{"id":7626,"date":"2021-12-16T09:17:34","date_gmt":"2021-12-16T00:17:34","guid":{"rendered":"https:\/\/gunmagisgeek.com\/blog\/?p=7626"},"modified":"2021-12-16T09:40:44","modified_gmt":"2021-12-16T00:40:44","slug":"deck-gl%e3%81%a7%e3%83%9d%e3%82%a4%e3%83%b3%e3%83%88%e3%82%af%e3%83%a9%e3%82%a6%e3%83%89ply%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/deck-gl\/7626","title":{"rendered":"deck.gl\u3067\u30dd\u30a4\u30f3\u30c8\u30af\u30e9\u30a6\u30c9\u3092\u8868\u793a\u3059\u308b"},"content":{"rendered":"\n<p>\u3053\u306e\u8a18\u4e8b\u306f<a href=\"https:\/\/qiita.com\/advent-calendar\/2021\/deckgl\">deck.gl Advent Calendar 2021&nbsp;<\/a>\u53c2\u52a0\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6982\u8981<\/h2>\n\n\n\n<p>\u6700\u8fd1\u3067\u306f\u3001\u70b9\u7fa4\u30c7\u30fc\u30bf\u3092\u30b9\u30ad\u30e3\u30f3\u3067\u304d\u308b<a href=\"https:\/\/apps.apple.com\/us\/app\/everypoint\/id1531900027?itsct=apps_box_link&amp;itscg=30200\" data-type=\"URL\" data-id=\"https:\/\/apps.apple.com\/us\/app\/everypoint\/id1531900027?itsct=apps_box_link&amp;itscg=30200\">EveryPoint<\/a>\u306a\u3069\u306e\u30a2\u30d7\u30ea\u304c\u6ce8\u76ee\u3092\u96c6\u3081\u3066\u3044\u307e\u3059\u304c\u3001deck.gl\u3092\u4f7f\u3046\u3068\u3053\u308c\u3089\u306e\u30a2\u30d7\u30ea\u3067\u64ae\u5f71\u3057\u305fply\u5f62\u5f0f\u306e\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3093\u3067\u30b5\u30af\u30c3\u3068\u30dd\u30a4\u30f3\u30c8\u30af\u30e9\u30a6\u30c9\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u3001\u30ed\u30fc\u30c0\u30fc\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3067\u540c\u69d8\u306e\u30b3\u30fc\u30c9\u3067 las\/laz\u30c7\u30fc\u30bf \u306e\u30dd\u30a4\u30f3\u30c8\u30af\u30e9\u30a6\u30c9\u3082\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u306a\u304a\u3001deck.gl\u306f\u30dd\u30a4\u30f3\u30c8\u30af\u30e9\u30a6\u30c9(\u70b9\u7fa4)\u3067\u306f\u306a\u3044\u901a\u5e38\u306e3D\u30e2\u30c7\u30eb\u3082\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u305d\u308c\u306f\u307e\u305f\u5225\u9014\u8a18\u4e8b\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<p>\u8868\u793a\u3057\u3066\u3044\u308b\u30e2\u30c7\u30eb\u306fiPhone\u3067\u3066\u304d\u3068\u3046\u306b\u64ae\u5f71\u3057\u305f\u99c5\u306e\u81ea\u8ca9\u6a5f\u3067\u3059\u3002\uff08\u30b9\u30de\u30db\u3060\u3068\u521d\u56de\u306f\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3093\u3067\u304b\u3089\u8868\u793a\u3055\u308c\u308b\u307e\u3067\u306b\u3061\u3087\u3063\u3068\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\uff09<\/p>\n\n\n\n<iframe src=\"https:\/\/codesandbox.io\/embed\/deck-gl-pointokuraudo-ply-wobiao-shi-suru-9wzm7?fontsize=14&amp;hidenavigation=1&amp;theme=dark&amp;view=split\" style=\"width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;\" title=\"deck.gl - \u30dd\u30a4\u30f3\u30c8\u30af\u30e9\u30a6\u30c9(ply)\u3092\u8868\u793a\u3059\u308b\" allow=\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\" sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"><\/iframe>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u8aac<\/h2>\n\n\n\n<p><a href=\"https:\/\/loaders.gl\/\" data-type=\"URL\" data-id=\"https:\/\/loaders.gl\/\">loaders.gl<\/a>\u306e<a href=\"https:\/\/loaders.gl\/modules\/ply\/docs\/api-reference\/ply-loader\" data-type=\"URL\" data-id=\"https:\/\/loaders.gl\/modules\/ply\/docs\/api-reference\/ply-loader\">PLYLoader<\/a>\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u307f\u3001\u305d\u306e\u30c7\u30fc\u30bf\u3092<a href=\"https:\/\/deck.gl\/docs\/api-reference\/layers\/point-cloud-layer\" data-type=\"URL\" data-id=\"https:\/\/deck.gl\/docs\/api-reference\/layers\/point-cloud-layer\">PointCloudLayer<\/a>\u306b\u6e21\u3057\u3066\u30dd\u30a4\u30f3\u30c8\u30af\u30e9\u30a6\u30c9\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>deck.gl\u306b<a href=\"https:\/\/deck.gl\/docs\/api-reference\/core\/orbit-view\" data-type=\"URL\" data-id=\"https:\/\/deck.gl\/docs\/api-reference\/core\/orbit-view\">OrbitView<\/a>\u3092\u6307\u5b9a\u3057<em>\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/em>\u3092\u4e2d\u5fc3\u306b\u30ab\u30e1\u30e9\u304c\u56de\u8ee2\u3059\u308b\u3088\u3046\u306b\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js decode:true \">\/\/OrbitView\u3092\u8aad\u307f\u8fbc\u307f\nimport DeckGL, { OrbitView } from \"deck.gl\";\n\n\n\/\/PLY\u30ed\u30fc\u30c0\u30fc\u3092\u8aad\u307f\u8fbc\u3080\nimport { PLYLoader } from \"@loaders.gl\/ply\";\nimport { load } from \"@loaders.gl\/core\";\n\n\n\/\/\u521d\u671f\u30ab\u30e1\u30e9\u4f4d\u7f6e\u306e\u8a2d\u5b9a\nconst INITIAL_VIEW_STATE = {\n    target: [0, 0, 0],\n    rotationX: 0,\n    rotationOrbit: 0,\n    minZoom: 0,\n    maxZoom: 10,\n    zoom: 1\n};\n\nconst App = () =&gt; {\n    \/\/ply\u30c7\u30fc\u30bf\u3092\u4fdd\u7ba1\u3059\u308b\u5909\u6570\n    const [data, setData] = useState();\n\n    \/\/\u30ab\u30e1\u30e9\u306e\u521d\u671f\u8a2d\u5b9a\u3092\u884c\u3046\n    const [viewState, setViewState] = useState(INITIAL_VIEW_STATE);\n\n    useEffect(() =&gt; {\n        const dataload = async () =&gt; {\n            \/\/ply\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\n            const res = await load(\".\/data\/test.ply\", PLYLoader);\n\n            \/\/\u8aad\u307f\u8fbc\u3093\u3060PLY\u30c7\u30fc\u30bf\u306eBounding box\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\n            const [mins, maxs] = res.header.boundingBox;\n\n            \/\/Bounding box\u3092\u5143\u306b\u30dd\u30a4\u30f3\u30c8\u30af\u30e9\u30a6\u30c9\u304c\u753b\u9762\u306b\u53ce\u307e\u308b\u4f4d\u7f6e\u3078\u30ab\u30e1\u30e9\u3092\u79fb\u52d5\u3059\u308b\n            setViewState({\n                ...INITIAL_VIEW_STATE,\n                target: [\n                    (mins[0] + maxs[0]) \/ 2,\n                    (mins[1] + maxs[1]) \/ 2,\n                    (mins[2] + maxs[2]) \/ 2\n                ],\n                zoom: Math.log2(window.innerWidth \/ (maxs[0] - mins[0]))\n            });\n\n            \/\/data\u5909\u6570\u3092update\n            setData(res);\n        };\n        dataload();\n    }, []);\n\n\n    \/\/\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\n    return (\n        &lt;div className=\"App\"&gt;\n            &lt;DeckGL\n                \/\/OrbitView \u3092\u6307\u5b9a\n                views={new OrbitView({ fov: 50 })}\n                initialViewState={viewState}\n                controller={true}\n                layers={renderLayers({\n                    data: data\n                })}\n                parameters={{\n                    clearColor: [0.93, 0.86, 0.81, 1] \/\/\u30dd\u30a4\u30f3\u30c8\u306e\u30ab\u30e9\u30fc\u8abf\u6574\n                }}\n            \/&gt;\n        &lt;\/div&gt;\n    );\n};\n\nexport default App;\n<\/pre><\/div>\n\n\n\n<p>\u30ec\u30a4\u30e4\u30fc\u5074\u3067\u306fply\u30c7\u30fc\u30bf\u306e\u5ea7\u6a19\u306b\u5408\u308f\u305b\u3066\u3001coordinateSystem\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u76f4\u4ea4\u5ea7\u6a19\u7cfb(CARTESIAN)\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js mark:4 decode:true \">  const layer = new PointCloudLayer({\n    id: 'laz-point-cloud-layer',\n    data: data,\n    coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n    getNormal: [0, 1, 0],\n    getColor: [255, 255, 255],\n    opacity: 0.5,\n    pointSize: 0.5,\n  })<\/pre><\/div>\n\n\n\n<p>las\/laz\u30c7\u30fc\u30bf\u306e\u30dd\u30a4\u30f3\u30c8\u30af\u30e9\u30a6\u30c9\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u307f\u305f\u3044\u5834\u5408\u306floaders.gl\u306e<a href=\"https:\/\/loaders.gl\/modules\/las\/docs\/api-reference\/las-loader\" data-type=\"URL\" data-id=\"https:\/\/loaders.gl\/modules\/las\/docs\/api-reference\/las-loader\">LASLoader<\/a>\u3092\u5229\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u306fdeck.gl Advent Calen&hellip;<\/p>\n","protected":false},"author":1,"featured_media":7749,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-7626","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-deck-gl","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=7626"}],"version-history":[{"count":18,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7626\/revisions"}],"predecessor-version":[{"id":7842,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7626\/revisions\/7842"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/7749"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=7626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=7626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=7626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}