<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic API_Coord to API_Transmat in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Coord-to-API-Transmat/m-p/596816#M9275</link>
    <description>&lt;P&gt;Hi&lt;BR /&gt;&lt;BR /&gt;Anyone has an idea how can i place/create a hotlink element based on 2D API_Coord (x and y positions)?&lt;BR /&gt;I did some testing and for an Object Element, the position is referenced to the Project Origin (If my understanding is correct)&lt;BR /&gt;Red = Project Origin&lt;BR /&gt;Green = User Origin&lt;BR /&gt;Where Obj pos.x = ~0.0 and pos.y = ~0.0&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kristkun_0-1711655567876.jpeg" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/58124i75B067BC5700B604/image-size/large?v=v2&amp;amp;px=999" role="button" title="kristkun_0-1711655567876.jpeg" alt="kristkun_0-1711655567876.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But when I created a hotlink element with x=0, y=0, z=0 coordinates it was placed here&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kristkun_1-1711655619720.jpeg" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/58125iD135F7A380DCC2A8/image-size/large?v=v2&amp;amp;px=999" role="button" title="kristkun_1-1711655619720.jpeg" alt="kristkun_1-1711655619720.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Im using this code from the example references to convert 3d coordinates to API_Transmat&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;static API_Tranmat CreateTransformation(const API_Coord3D&amp;amp; origin, const double rotAngle)
{
	API_Tranmat transformation = {};

	const double	co = cos(rotAngle);
	const double	si = sin(rotAngle);
	// we need an orthogonal transformation
	// origin
	transformation.tmx[3] = origin.x;
	transformation.tmx[7] = origin.y;
	transformation.tmx[11] = origin.z;
	// X axis
	transformation.tmx[0] = co;
	transformation.tmx[4] = si;
	transformation.tmx[8] = 0.0;
	// Y axis
	transformation.tmx[1] = -si;
	transformation.tmx[5] = co;
	transformation.tmx[9] = 0.0;
	// we need a valid Z axis as well
	transformation.tmx[2] = 0.0;
	transformation.tmx[6] = 0.0;
	transformation.tmx[10] = 1.0;

	return transformation;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2024 12:48:59 GMT</pubDate>
    <dc:creator>kristkun</dc:creator>
    <dc:date>2024-09-16T12:48:59Z</dc:date>
    <item>
      <title>API_Coord to API_Transmat</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Coord-to-API-Transmat/m-p/596816#M9275</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;&lt;BR /&gt;Anyone has an idea how can i place/create a hotlink element based on 2D API_Coord (x and y positions)?&lt;BR /&gt;I did some testing and for an Object Element, the position is referenced to the Project Origin (If my understanding is correct)&lt;BR /&gt;Red = Project Origin&lt;BR /&gt;Green = User Origin&lt;BR /&gt;Where Obj pos.x = ~0.0 and pos.y = ~0.0&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kristkun_0-1711655567876.jpeg" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/58124i75B067BC5700B604/image-size/large?v=v2&amp;amp;px=999" role="button" title="kristkun_0-1711655567876.jpeg" alt="kristkun_0-1711655567876.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But when I created a hotlink element with x=0, y=0, z=0 coordinates it was placed here&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kristkun_1-1711655619720.jpeg" style="width: 999px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/58125iD135F7A380DCC2A8/image-size/large?v=v2&amp;amp;px=999" role="button" title="kristkun_1-1711655619720.jpeg" alt="kristkun_1-1711655619720.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Im using this code from the example references to convert 3d coordinates to API_Transmat&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;static API_Tranmat CreateTransformation(const API_Coord3D&amp;amp; origin, const double rotAngle)
{
	API_Tranmat transformation = {};

	const double	co = cos(rotAngle);
	const double	si = sin(rotAngle);
	// we need an orthogonal transformation
	// origin
	transformation.tmx[3] = origin.x;
	transformation.tmx[7] = origin.y;
	transformation.tmx[11] = origin.z;
	// X axis
	transformation.tmx[0] = co;
	transformation.tmx[4] = si;
	transformation.tmx[8] = 0.0;
	// Y axis
	transformation.tmx[1] = -si;
	transformation.tmx[5] = co;
	transformation.tmx[9] = 0.0;
	// we need a valid Z axis as well
	transformation.tmx[2] = 0.0;
	transformation.tmx[6] = 0.0;
	transformation.tmx[10] = 1.0;

	return transformation;
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 12:48:59 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/API-Coord-to-API-Transmat/m-p/596816#M9275</guid>
      <dc:creator>kristkun</dc:creator>
      <dc:date>2024-09-16T12:48:59Z</dc:date>
    </item>
  </channel>
</rss>

