SVG.js How to update pattern scale and position? - drawing

Hi I'm trying to fill a polygon with a pattern here https://codesandbox.io/s/pmqv6vxvw0 (watch the HelloWorld.vue the drawPath() and anymPath() there)
Looks like it has the only option to update element, not the pattern's parameter enter link description here
Is there a way to change the scale as well?
And the pattern alignment, is it possible to move the pattern into the middle of the container?

Related

Removing text and only showing a portion of the answer

I'm trying to run an index match that returns some text, but I don't want the full text, just the portion that varies within the set. For example, cell A1 would contain...
[I want to better understand what you did during this visit] During this visit, did the you... (select appropriate answer) [Receive a tour]
A2...
[I want to better understand what you did during this visit] During this visit, did the you... (select appropriate answer) [Meet with the manager]
How would you extract it to just say...
A1 A2
Receive a tour Meet with the manager
The text can vary a lot, sometimes it'll have a second set of square brackets, sometimes not. But one consistency within Google Form data is that the last pair of square brackets is that part that contains the answer that varies. I'd like to get just this text.
...is that the last pair of square brackets is that part that contains the answer that varies. I'd like to get just this text
try this:
=ARRAYFORMULA(IFERROR(REGEXEXTRACT(A1:A, "([^\[]*)\]$")))
or more blunt:
=ARRAYFORMULA(IFERROR(REGEXEXTRACT(A1:A, "\s\[(.*)\]$")))

Fenics subdomain indicator in mesh file

In the Fenics documentation, it is mentionned that
DirichletBC takes three arguments, the first one is our function space V, the next is the boundary condition value and the third is the subdomain indicator which is information stored in the mesh.
Where is the subdomain indicator in the mesh file? How do I change it's value?
Context: I am solving on a domain that has multiple boundary parts, with a constant Dirichlet condition on each part.
The mesh file I'm using was generated using Triangle, and dolfin-convert to get an xml file.
It is my understanding that meshing tools such as GMSH natively provide the option to mark boundaries, but I would rather not resort to another mesher, since I am used to Triangle.
I didn't figure out how to modify the mesh to add boundary markers, but I did find a workaround to part of the problem in page 9 of this document.
The idea is to define a boundary condition for each boundary
u_1 = Constant(0.0)
def b_1(x, on_boundary):
return on_boundary and \
near(x[0]*x[0]+x[1]*x[1], 1, 1e-2)
then defining a list of boundary conditions that can be passed to the solve function
bcs = [DirichletBC(V, u_1, b_1), ...]
However, this will only work if each boundary can be described by an equation. So this is not a general solution to the problem

Notepad++ truncate LatLng data

I have a KML file that has multiple coordinates. I want to trim the coordinates to see if it will reduce the size.
CHANGES
The LatLng is different and not in a consistent format. Below is a sample of the LatLng that I have within my file. My apologies for not using a more accurate capture I didn't realize that it would affect the RegEx.
20.0649556884364,42.546758117893,0
-6.665609089909049,61.4394550582227,0
142.843146200241,54.2804088338613,0
This goes on for awhile as it is a multigeometry polygon. I would like to reduce the LatLng to 20.1234,20.1234
How do I remove the last 9 digits leaving only 4 after the period?
Find what:
(\.\d{4})\d+
Replace with:
$1
DEMO

Search and retrieve patterns from a list

Let's say I have a list of patterns such like ['AB', ')', '%%', '<.*>'].
I need to search for one of them forward or backward, starting from the cursor position.
Once the first one is found, how do I retrieve its index in the list? I.e, how do I know which one it is?
[EDIT]: the thing is that I actually have two lists of the same size. Once the first match is found in one direction, I'll need to search the corresponding one in the other direction.
PLUS, each pattern is associated with a certain precedence (its index in the list), which I need to retrieve once it is found.
(The overall idea is to build something that would be able to answer this question, with custom delimiters and operators.)
Got it: the searchpos function with the 'p' flag allows you to retrieve the position and the id of the match in for a compound pattern, see :help searchpos.

Gomoku datas representation in C

I'm working on a Gomoku game I'm currently done with GUI etc, and I need to code the IA and Rule Checker (for optional rules such as Capture, forbidden patterns etc).
I was planning on representing the board with an int array something like:
uint goban[361];
Which would represent a 19 * 19 Goban (board). Let's say we can split a 32bit integer in 4 byte and within each byte we can stock metadata like this for example:
1st byte: Is this case empty/black/white ?
2nd byte: Is this case part of a special pattern ?
3rd byte: In which position of the pattern am I ?
4th byte: Am I capturable ?
I don't know if this kind of solution is suitable for a Gomoku AI but the main problem I've is how to write it properly. Let's take pattern:
-OO-O-
It's a open & free three, it has space inside and at the extremity. How Am I supposed to link this pattern with a static representation without coordinates ?
One other concern is when should I update pattern and how because out of 361 case it can be pretty long if I update the previous figure to this:
XOO-O-
I've to update all four case so I don't think it's apropriate, plus it can affect many other vertical / diagonal patterns.
Should I rather make a list of patterns currently on the map like this:
std::list<ThreatList> tlist;
and make the map a simple tribool or char array ?
I want my data representation to give me maximum information to get a fast update of the influence map which would be filled by my evaluation function. I've read couple things about threat space search and other Gomoku algorithm but they don't talk about data representation and I don't get how to do it correctly, can you please help me find a clean way to represent pattern and how to update them.
Thanks you.
Take a look at this open source Gomoku:
https://github.com/garretraziel/gomoku
I think you will find a lot of interesting ideas in there.