{"id":373,"date":"2011-10-05T19:09:39","date_gmt":"2011-10-05T18:09:39","guid":{"rendered":"http:\/\/devnot.wordpress.com\/?p=373"},"modified":"2022-03-24T19:04:11","modified_gmt":"2022-03-24T18:04:11","slug":"calculate-a-point-at-a-distance-perpendicular-to-a-vector-offset-2d","status":"publish","type":"post","link":"https:\/\/thomas-jansen.eu\/?p=373","title":{"rendered":"Calculate a point at a distance perpendicular to a vector offset (2D)"},"content":{"rendered":"\n\n\n<p>To calculate a point at a distance perpendicular to a vector offset<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomasjansen.eu\/wp-content\/uploads\/2019\/12\/wp_point_perp_distance-1.svg\" alt=\"\" class=\"wp-image-574\" width=\"369\" height=\"277\"\/><figcaption>Point perpendicular to offset<br><\/figcaption><\/figure>\n\n\n\n<p>First the point on the vector <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-826a6b6ef2df8068bcf3220db0d2c79a_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#80;&#39;\" title=\"Rendered by QuickLaTeX.com\" height=\"14\" width=\"18\" style=\"vertical-align: 0px;\"\/> at the required offset needs to be calculated. This easy to do:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-8b909f8da6c11fefb46d4b22b64e9f61_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#80;&#39;&#32;&#61;&#32;&#65;&#32;&#43;&#32;&#40;&#66;&#45;&#65;&#41;&#32;&#42;&#32;&#111;&#102;&#102;&#115;&#101;&#116;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"209\" style=\"vertical-align: -4px;\"\/><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-6b44748c337b8ccb9871548f67fe3ee9_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#80;&#39;&#95;&#120;&#32;&#61;&#32;&#65;&#95;&#120;&#32;&#43;&#32;&#40;&#66;&#95;&#120;&#32;&#45;&#32;&#65;&#95;&#120;&#41;&#32;&#42;&#32;&#111;&#102;&#102;&#115;&#101;&#116;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"235\" style=\"vertical-align: -4px;\"\/> <br><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-32c0b2369624d1a4c426bb349634a8dc_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#80;&#39;&#95;&#121;&#32;&#61;&#32;&#65;&#95;&#121;&#32;&#43;&#32;&#40;&#66;&#95;&#121;&#32;&#45;&#32;&#65;&#95;&#121;&#41;&#32;&#42;&#32;&#111;&#102;&#102;&#115;&#101;&#116;\" title=\"Rendered by QuickLaTeX.com\" height=\"21\" width=\"233\" style=\"vertical-align: -7px;\"\/> <\/p>\n\n\n\n<p>The vector to move the point P&#8217; on is perpendicular to <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-01e3f48fa11a50273e3889539222abe7_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#92;&#111;&#118;&#101;&#114;&#108;&#105;&#110;&#101;&#123;&#65;&#66;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"28\" style=\"vertical-align: 0px;\"\/>. This vector can be calculated using a 90 degree rotation matrix:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-737620d5b90779f94a3100cfba6f2eec_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#98;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#32;&#99;&#111;&#115;&#32;&#92;&#97;&#108;&#112;&#104;&#97;&#32;&#32;&#32;&#38;&#32;&#45;&#115;&#105;&#110;&#32;&#92;&#97;&#108;&#112;&#104;&#97;&#32;&#92;&#92;&#32; &#32;&#115;&#105;&#110;&#32;&#92;&#97;&#108;&#112;&#104;&#97;&#32;&#32;&#38;&#32;&#99;&#111;&#115;&#32;&#92;&#97;&#108;&#112;&#104;&#97;&#32;&#92;&#92; &#92;&#101;&#110;&#100;&#123;&#98;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#32;&#32;&#61; &#92;&#98;&#101;&#103;&#105;&#110;&#123;&#98;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#32;&#99;&#111;&#115;&#32;&#57;&#48;&#32;&#32;&#38;&#32;&#45;&#115;&#105;&#110;&#32;&#57;&#48;&#32;&#92;&#92;&#32; &#32;&#115;&#105;&#110;&#32;&#57;&#48;&#32;&#32;&#38;&#32;&#99;&#111;&#115;&#32;&#57;&#48;&#92;&#92; &#92;&#101;&#110;&#100;&#123;&#98;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#61; &#92;&#98;&#101;&#103;&#105;&#110;&#123;&#98;&#109;&#97;&#116;&#114;&#105;&#120;&#125; &#32;&#48;&#32;&#32;&#38;&#32;&#45;&#49;&#32;&#92;&#92;&#32; &#32;&#49;&#32;&#32;&#38;&#32;&#32;&#48;&#32;&#92;&#92;&#32; &#32;&#92;&#101;&#110;&#100;&#123;&#98;&#109;&#97;&#116;&#114;&#105;&#120;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"43\" width=\"361\" style=\"vertical-align: -17px;\"\/><\/pre>\n\n\n\n<p>The matrix shows in the the first row <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-fb75e3cf0fc3691c2ea7ed13303180b3_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#120;&#39;&#61;&#32;&#45;&#121;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"61\" style=\"vertical-align: -4px;\"\/> and the second row shows <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-c26fad15fed4ef6afab930ebef00486a_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#121;&#39;&#61;&#32;&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"48\" style=\"vertical-align: -4px;\"\/><\/p>\n\n\n\n<p>You can safely ignore the stuff above if you are only interested in getting the job done. The final formula is:<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-a26b2dfc7592161cf9cc0c559200fe07_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#112;&#109;&#97;&#116;&#114;&#105;&#120;&#125;&#120;&#39;&#92;&#92;&#121;&#39;&#32;&#92;&#101;&#110;&#100;&#123;&#112;&#109;&#97;&#116;&#114;&#105;&#120;&#125;&#61;&#32;&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#112;&#109;&#97;&#116;&#114;&#105;&#120;&#125;&#45;&#121;&#92;&#92;&#120;&#32;&#92;&#101;&#110;&#100;&#123;&#112;&#109;&#97;&#116;&#114;&#105;&#120;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"43\" width=\"108\" style=\"vertical-align: -17px;\"\/><br> <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>We will call the vector (<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-bc51588e5e4bfa836ca826ff548bffcf_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#92;&#111;&#118;&#101;&#114;&#108;&#105;&#110;&#101;&#123;&#80;&#39;&#80;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"33\" style=\"vertical-align: 0px;\"\/>)  vector <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-ed12970f60569db1dfd9f13289854a0d_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#67;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"14\" style=\"vertical-align: 0px;\"\/>.  <\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-157fe020f962edd0cb71b8427e1791dd_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#67;&#32;&#61;&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#112;&#109;&#97;&#116;&#114;&#105;&#120;&#125;&#45;&#32;&#40;&#66;&#95;&#121;&#32;&#45;&#32;&#65;&#95;&#121;&#41;&#92;&#92;&#32;&#32;&#32;&#66;&#95;&#120;&#32;&#45;&#32;&#65;&#95;&#120;&#32;&#92;&#101;&#110;&#100;&#123;&#112;&#109;&#97;&#116;&#114;&#105;&#120;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"43\" width=\"153\" style=\"vertical-align: -17px;\"\/><br><\/p>\n\n\n\n<p> Vector <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-ed12970f60569db1dfd9f13289854a0d_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#67;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"14\" style=\"vertical-align: 0px;\"\/> needs to be normalized (divided by it&#8217;s length \/ magnitude). <\/p>\n\n\n\n<p> <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-f28853c07446e86fbffc637087680ea1_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#92;&#104;&#97;&#116;&#123;&#67;&#125;&#32;&#61;&#92;&#100;&#102;&#114;&#97;&#99;&#123;&#67;&#125;&#123;&#92;&#108;&#101;&#102;&#116;&#32;&#92;&#124;&#67;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#32;&#92;&#124;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"41\" width=\"72\" style=\"vertical-align: -17px;\"\/> <\/p>\n\n\n\n<p>The resulting formula becomes:<\/p>\n\n\n\n<p> <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/thomas-jansen.eu\/wp-content\/ql-cache\/quicklatex.com-26bbaacaf93fa72cd54d20111b7bf5bb_l3.svg\" class=\"ql-img-inline-formula \" alt=\"&#80;&#32;&#61;&#32;&#40;&#65;&#32;&#43;&#32;&#40;&#66;&#45;&#65;&#41;&#32;&#42;&#32;&#111;&#102;&#102;&#115;&#101;&#116;&#41;&#32;&#43;&#32;&#92;&#104;&#97;&#116;&#32;&#123;&#67;&#125;&#32;&#42;&#32;&#100;&#105;&#115;&#116;&#97;&#110;&#99;&#101;\" title=\"Rendered by QuickLaTeX.com\" height=\"21\" width=\"337\" style=\"vertical-align: -4px;\"\/><\/p>\n\n\n\n<p>A positive distance will get the point above the vector, a negative below the vector.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To calculate a point at a distance perpendicular to a vector offset First the point on the vector $P&#8217;$ at the required offset needs to be calculated. This easy to do: $P&#8217; = A + (B-A) * offset$ $P&#8217;_x = A_x + (B_x &#8211; A_x) * offset$ $P&#8217;_y = A_y + (B_y &#8211; A_y) * [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[55,56,82],"class_list":["post-373","post","type-post","status-publish","format-standard","hentry","category-geometry","tag-perpendicular","tag-point","tag-vector"],"_links":{"self":[{"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/posts\/373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=373"}],"version-history":[{"count":5,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/posts\/373\/revisions"}],"predecessor-version":[{"id":681,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=\/wp\/v2\/posts\/373\/revisions\/681"}],"wp:attachment":[{"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thomas-jansen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}